One of the new features in SPSS version 12 is OMS, which stands for Output Management System. This “system” is a series of commands that allows you to output the results from any procedure into an SPSS data file, as well as several other formats. To keep things simple, we will only look at outputting results to a data set.
To start, you use the oms command. The only subcommand that is technically required with this command is the destination subcommand, on which you tell SPSS in what format to save your output and where you want that file to be saved. Often, you also need to use the if subcommand, on which you specify which tables of the output that you want in your output data file. This is necessary because it is often not possible to create one data set with all of the tables from the output in it. (Of course, this is not true of other output formats, such as html.) To end your OMS session, you can either issue the omsend command, or end your SPSS session. You can have multiple OMS sessions running concurrently, and you keep track of them with the tab subcommand. With the tab subcommand, you can name the session when you start it, and then use that name on the tab subcommand on the omsend command. You can get information on the various OMS sessions that are currently running by issuing the omsinfo command.
Let’s use the hsb2 data set for our example. Suppose that we want to run a crosstab and output the results to a data set. First, we would start our OMS session by issuing the oms command. We will specify that we want our output saved as a data file and that we would like this file saved on the D: drive. On the if subcommand, after the commands keyword, we specify that we want output created by the crosstabs command, and after the subtypes keyword, we specify that we want the contents of the Crosstabulation table. (The Case Processing Summary table would have been another option.) The quotes around the name of the command and the table are necessary, as is the use of the equals signs and the square brackets. Once we have started our OMS session, we issue the crosstabs command, end our OMS session, and then open the new data file. We use the list command to see the data file in the output window. (NOTE: Although you can type crosstab instead of crosstabs and get the correct output, in the oms command, you must use crosstabs. If you use crosstab, you will not have any data in your new file.)
get file "D:\hsb2.sav".oms select tables /destination format = sav outfile = "D:results.sav" /if commands = ['crosstabs'] subtypes = ['Crosstabulation'].crosstabs tables = female by prog.omsend.get file "D:\results.sav". list.The variables are listed in the following order:LINE 1: Command_ Subtype_ Label_LINE 2: Var1 Var2 Var3 @1.00 @2.00 @3.00 TotalCommand_: Crosstabs Crosstabulation female * type of program Crosstabulation Var1: female .00 Count 21 47 23 91Command_: Crosstabs Crosstabulation female * type of program Crosstabulation Var1: female 1.00 Count 24 58 27 109Command_: Crosstabs Crosstabulation female * type of program Crosstabulation Var1: Total Count 45 105 50 200Number of cases read: 3 Number of cases listed: 3
Now let’s try a slightly more complex example. We will have two OMS sessions running concurrently and use one to obtain the regression coefficients from a regression analysis and the other to obtain the correlation coefficients from the correlations procedure. As you can see with the regression analyses, you can save the output from various analyses in the same data set. We have also used the numbered keyword on the destination subcommand to add a new variable to our data set called Table_Number. This will tell us from which table the data are taken.
get file "D:\hsb2.sav". oms select tables /destination format = sav numbered = "Table_Number" outfile = "D:results1.sav" /if commands = ['regression'] subtypes = ['Coefficients'] /tag = "reg". oms select tables /destination format = sav outfile = "D:results2.sav" /if commands = ['Correlations'] subtypes = ['Correlations'] /tag = "cor". regression dependent = write /method = enter female read. correlations /variables = write read math female. omsend tag = ["cor"]. regression dependent = write /method = enter female math. regression dependent = write /method = enter female read math. omsinfo.
omsend tag = ["reg"].get file "D:\results1.sav". list.Table_Number Var2 B Std.Error Beta t Sig1 (Constant) 20.228 2.714 . 7.454 .000 1 female 5.487 1.014 .289 5.410 .000 1 reading score .566 .049 .612 11.459 .000 2 (Constant) 16.614 2.909 . 5.711 .000 2 female 5.218 .998 .275 5.231 .000 2 math score .633 .053 .626 11.906 .000 3 (Constant) 11.896 2.863 . 4.155 .000 3 female 5.443 .935 .287 5.822 .000 3 reading score .325 .061 .352 5.355 .000 3 math score .397 .066 .393 5.986 .000Number of cases read: 10 Number of cases listed: 10get file "D:\results2.sav". list.Var1 Var2 writingscore readingscore mathscore femalewriting score Pearson Correlation 1 .597 .617 .256 writing score Sig. (2-tailed) . .000 .000 .000 writing score N 200 200.0 200.0 200.0 reading score Pearson Correlation 1 1.000 .662 -.053 reading score Sig. (2-tailed) 0 . .000 .455 reading score N 200 200.0 200.0 200.0 math score Pearson Correlation 1 .662 1.000 -.029 math score Sig. (2-tailed) 0 .000 . .680 math score N 200 200.0 200.0 200.0 female Pearson Correlation 0 -.053 -.029 1.000 female Sig. (2-tailed) 0 .455 .680 . female N 200 200.0 200.0 200.0Number of cases read: 12 Number of cases listed: 12
For our last example, we will output different tables from the output to different data files. This is handy because you cannot combine certain tables with other tables into the same data set using OMS. For example, you cannot create a data set with the regression coefficients and the model summary statistics. Therefore, we will output these tables to different data sets. If you want them in the same data set, you can then merge the two data files.
get file "D:\hsb2.sav".oms select tables /destination format = sav numbered = "TN" outputset = Coefficients Anova folder = "D:results3.sav" Model Summary folder = "D:results4.sav" /if commands = ['regression'] subtypes = ['Coefficients' 'Anova' 'Model Summary'].regression dependent = write /method = enter female math.omsend.get file "D:\results3.sav". list /var = TN subtype_ to t.get file "D:\hsb2.sav".oms select tables /destination format = sav numbered = "TN" outputset = Coefficients Anova folder = "D:results3.sav" Model Summary folder = "D:results4.sav" /if commands = ['regression'] subtypes = ['Coefficients' 'Anova' 'Model Summary'].regression dependent = write /method = enter female math.omsend.get file "D:\results3.sav". list /var = TN subtype_ to t.
get file "D:\results4.sav". list.Adjus Va RSqu tedRS Std.Errorof TN Command_ Subtype_ Label_ r1 R are quare theEstimate1 Regression Model Summary Model Summary 1 .676 .457 .451 7.02182Number of cases read: 1 Number of cases listed: 1
Note that the length of the string variables Subtype_ and Label_ may be different in the two files. If they are, you will need to make them the same before you can merge the files. The easiest way to do this is to change them in the Variable View of the Data Editor. You can then use the command below to merge the two files.
match files file = "D:\results3.sav" /table = "D:\results4.sav" /by TN. exe.