sparkEmbeddedProcess

executeProgram

Description

Executes arbitrary programs inside the SAS Embedded Process for Spark. This action enables the submission of plain text Scala programs or Scala programs stored in a local file for execution within the Spark environment defined by the specified caslib.

sparkEmbeddedProcess.executeProgram <result=results> <status=rc> / caslib="string", program="string", programFile="string";
Settings
ParameterDescription
caslibSpecifies the caslib containing the data source options. Alias: datasourceFromCasLib. (Required)
programSpecifies the plain text arbitrary Scala program that is executed inside Spark using the SAS Embedded Process.
programFileSpecifies a local file name containing an arbitrary Scala program that is submitted for execution inside Spark using the SAS Embedded Process.
Data Preparation View data prep sheet
CAS Session Setup

Establish a connection to the CAS server.

Copied!
1cas mySession sessopts=(caslib="casuser");
2LIBNAME casuser cas caslib="casuser";
3 

Examples

Executes a simple Scala print command directly within the Spark Embedded Process associated with the 'sparkLib' caslib.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3sparkEmbeddedProcess.executeProgram / caslib="sparkLib" program="println(\"Hello from Spark EP\")";
4 
5RUN;
6 
Result :
The Scala code runs in the Spark session, printing the message to the standard output of the Spark process.

Executes a Scala program stored in a local file named 'complex_logic.scala' within the Spark Embedded Process.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3sparkEmbeddedProcess.executeProgram / caslib="sparkLib" programFile="/path/to/complex_logic.scala";
4 
5RUN;
6 
Result :
The logic defined in the local Scala file is transmitted to and executed within the Spark environment.

FAQ

What is the primary function of the executeProgram action?
Which parameter is required to run the executeProgram action?
What is the alias for the 'caslib' parameter?
How can I submit a Scala program directly as a string?
How can I execute a Scala program stored in a local file?
What is the basic CASL syntax for calling this action?