Batch Execution
Using a Local SAS Workspace Server
You can use a SAS Workspace Server that runs on the local host to load SAS data, save SAS data, or submit SAS code during a batch mode run.
Simulation Studio provides two different methods of connecting to a local SAS Workspace Server:
Default local Workspace Server: On the Windows operating system, you can use this SAS Workspace Server, which Simulation Studio launches automatically when required. This server does not require configuration or credentials when you are running in batch mode. Note: The default local Workspace Server is not available on the Linux operating system.
SAS Simulation Studio Object Spawner for SAS Services: You can connect to this SAS Workspace Server by specifying an
authinfofile. This approach works on both Windows and Linux operating systems. To establish connection using this method in batch mode, you must specify the following arguments:-authpathfollowed by the file path to the
authinfofile-locportfollowed by the port number for the local SAS Workspace Server
If the -authpath and -locport options are specified, SAS Simulation Studio does not use default local Workspace Server in batch mode.
The following lines are examples of the content in an authinfo file:
host hostname port port1 user your-userid1 password your-password1 host hostname user your-userid2 password your-password2 default user your-userid password your-password
The user credentials specified in the line starting with default are used to authenticate to the local SAS Workspace Server. For more information about creating authinfo files, see Client Authentication Using an Authinfo File.
Examples: Using the Default Local SAS Workspace Server
The following examples illustrate data input and output by using local SAS Workspace Servers; they also demonstrate the use of the -i, -r, -d, -locdfp, and -authpath batch mode options.
Executing a Model with Data Input
This example illustrates the use of command line arguments and involves data input from multiple SAS data sets on a local host that has a Windows operating system. The docObsSource model (available in your /projects/examples folder) is used in this example. (For more information about the docObsSource example, see the section Using the Observation Source Block to Set Entity Attributes). The batch mode command is as follows:
simstudio_batch -m projects/examples/docObsSource/model0.simmdl -e projects/examples/docObsSource/experiment0.simexp -locdfp C:/Users/<userid>/SASSimulationStudio/15.1 -nonparallel
Based on this command, the following actions are executed by Simulation Studio at run time before model execution:
The path to the model file is interpreted to be
(-locdfp + -m); that is,C:/Users/<userid>/SASSimulationStudio/15.1/projects/examples/ docObsSource/model0.simmdl
The path to the experiment file is interpreted to be
(-locdfp + -e); that is,C:/Users/<userid>/SASSimulationStudio/15.1/projects/examples/ docObsSource/experiment0.simexp
There are five data loading blocks in
model0.simmdl. Each block loads data from a different column in the same SAS data setentities.sas7bdat. The data set is specified asprojects\examples\docObsSource\entities.sas7bdatin each data loading block. This is interpreted to be(-locdfp + relative path in data loading block); that is,C:/Users/<userid>/SASSimulationStudio/15.1/projects/examples/ docObsSource/entities.sas7bdat
The SAS server connection is automatically established with the default SAS Workspace Server if Base SAS is installed on the local host. No user arguments are required.
Executing a Model with Data Output
This example illustrates the use of command line arguments and involves data output to a local host that has a Linux operating system. The docDatasetWriter model (available in your /projects/examples folder) is used in this example. (For more information about the docDatasetWriter example, see the section Using the Dataset Writer Block to Save Data during a Run).
The batch mode command is as follows:
simstudio_batch -m projects/examples/docDatasetWriter/model0.simmdl -e /projects/examples/docDatasetWriter/experiment0.simexp -locdfp /<path\ to user home>/SASSimulationStudio/15.1
When Simulation Studio executes a model that creates output data, it requires either the -locdfp option or the -r option to be specified in order to provide an output data location to write to.
Based on this command, the following actions are executed by Simulation Studio at run time before model execution:
The path to the model file is a relative path and is interpreted to be
(-locdfp + -m); that is,/<path to user home>/SASSimulationStudio/15.1/projects/examples/ docDatasetWriter/model0.simmdl
The path to the experiment file is a relative path and is interpreted to be
(-locdfp + -e); that is,/<path to user home>/SASSimulationStudio/15.1/projects/examples/ docDatasetWriter/experiment0.simexp
Output data are written to a folder whose name is
resultsby default. This folder is created in the location that is specified in the-locdfpoption. Therefore, the output location is interpreted to be(-locdfp + results); that is,/<path to user home>/SASSimulationStudio/15.1/results
If the
-locdfpoption is used, the argument must point to an existing folder; only theresultsfolder is created during execution. Theresultsfolder is deleted along with its contents and created anew on every execution.The SAS server connection is automatically established with the default SAS Workspace Server if Base SAS is installed on the local host. No user arguments are required.
Alternatively, the batch command to execute this example can also be specified as follows:
simstudio_batch -m /<path to user home>/SASSimulationStudio/15.1/ projects/examples/docDatasetHolderWriter/model0.simmdl -e /<path to user home>/SASSimulationStudio/15.1/projects/examples/ docDatasetWriter/experiment0.simexp -r /abc/def/resultdata
In this case, the output data is written to the /abc/def/resultdata folder. If the -r option is used, the argument can point to an existing folder or to a new location, which is created automatically before the data are written. The folder to which the output data are written is deleted along with its contents and created anew on every execution of the batch mode.