Creating a production job
Production jobs use command syntax to automate program functionality. You can insert special runtime symbols in production job command syntax files that can either prompt you to enter values before running the job or can use values specified on a command line. You can use these runtime symbols to specify data files, variable lists, and other parameters.
You can use the Paste button in dialog boxes to have the syntax generated by your selections pasted into a syntax window. That syntax can then be saved to syntax files.
See the topic Working with Syntax for more information.
To create a production job:
- From the
menus, choose
- Click New to create a new production job.
Figure 1. Production Facility, General tab - For syntax files, click the button with the
plus sign (+) icon and navigate to the Samples folder and select automaton.sps.
For information on where to find the Samples folder, see Sample Files.
- Enter an output filename and location. (You can use the Browse button to select a location and/or filename.)
- Select an output
format.
Available formats include Viewer file format, Word, Excel, HTML, PDF, and text. For this example, we use Viewer file format.
Runtime values defined in a production job file and used in a command syntax file simplify tasks such as running the same analysis for different data files or running the same set of commands for different sets of variables. For example, you could define the runtime value @datafile to prompt you for a data filename each time you run a production job that uses the string @datafile in place of a filename in the command syntax file.
In this example, we'll define three runtime values. For the first runtime value:
- For the Symbol name, enter @location.
All runtime value symbol names must begin with @ and must conform to variable naming rules. See the topic Variable names for more information.
- For
the Default Value, enter the location of the Samples folder.
For information on where to find the Samples folder, see Sample Files.
- For User Prompt, enter Where is the data file? (or something like that).
- Select (check) the Quote Value checkbox.
- For the second runtime value, enter @datafile for the Symbol, demo.sav for the Default Value, and What is the name of the data file? for the User Prompt -- and select (check) the Quote Value checkbox again.
- For the third runtime value, enter @varlist for the Symbol, gender inccat for the Default Value, and What variables should be used? for the User
Prompt -- but this time do not select the Quote Value checkbox.
When the production job runs, the values you supply for the runtime symbols will be substituted wherever those symbols appear in the command files included in the production job. Here is the syntax in automaton.sps:
CD @location. GET FILE=@datafile. FREQUENCIES VARIABLES=@varlist /BARCHART.
-
@location is used in the
CD
command to change the working directory location. -
@datafile is used with the
GET
command to open a data file. -
@varlist is used
with the
FREQUENCIES
command to specify the list of variables to include in the analysis.
The values provided in the Runtime Values table are used as the default values, which can be replaced when you run the production job.
Before testing the production job, you should save it.
-
@location is used in the
- Click Save As to save the production job.
- After saving the production
job, click Run to test it.
In the Run Options dialog, click Interactively, and then click OK.
Since the production job contains runtime values, the User Prompt dialog opens when you run the production job. It displays the prompt text and the default values defined in the Runtime Values tab. At this point, you could override any of the default values. For example, you could enter a different data file name or a different variable list.
- Click OK to run the job with the default values.
In this example, the production job produces a Viewer file that contains the results of the commands in the syntax file run with the default runtime values. The data file demo.sav was used to generate frequency tables and bar charts for the variables gender and inccat (income category).
Note: This example requires the Statistics Base option in order
to run and display results from the FREQUENCIES
command.