General Info: Writing a program requires commands and subcommands. Any
information that begins in the first column is assumed to be a new command.
Each additional line must be indented (one space is enough). Subcommands
begin with a backslash (/). They can follow on the same line as the command,
but for clarity they are usually placed on separate lines (indented, of
course). SPSS on UNIX does not require a period at the end of each command
but older versions do. You may want to use periods to instill the habit.
Title
title 'your title'.
|
- The title can be up to 60 characters and is bordered by single quotes |
Format
set width=80.
|
- Default output has lines 132 characters wide, this reformats for a standard computer screen. |
Data
data list list
|
- Data in program, free format (separated by spaces) |
data list fixed
/var1 1-2 var2 4-5. begin data 10 08 : 12 10 end data. |
- Data in program, fixed format (in specific columns) |
data list file=filename fixed
/var1 1-2 var2 4-5. |
- Data in external text file. filename is the data file you want read in. You can also use list (for free format) instead of fixed. |
Comments
*comments ignored by spss. |
- An asterisk in the first column causes the rest of the line to be ignored by SPSS |
General Info: Writing a program requires commands and subcommands. Each
command and subcommand must end with a semi-colon (;). Multiple commands
can be entered on the same line (each followed by a semi-colon), but for
clarity they are usually placed on separate lines.
Title
title 'your title';
|
- The title can be up to 60 characters and is bordered by single quotes |
Format
options ls=80 ps=120 nocenter; options ls=132 ps=55 ovp nocenter;
|
- ls is linesize (# of characters across), ps is pagesize
(# of lines per page), nocenter makes the output left-justified
and ovp means overprint lines (allows underlines, etc.)
- Use the first settings for normal output, the second is better for graphics |
Data
data tempname;
|
- Data in program, free format (separated by spaces). tempname is anything you choose. See the SAS book for more information about datasets. |
data tempname;
input var1 1-2 var2 4-5; cards 10 08 : 12 10 ; |
- Data in program, fixed format (in specific columns) |
data tempname;
infile=filename; input var1 var2; |
- Data in external text file. filename is the data file you want read in. The example is free format, but you can also specify columns. |
Comments
*comments ignored by sas;
|
- An asterisk causes all text until the next semi-colon to be ignored. A slash and asterisk cause all text to be ignored until the next asterisk and slash. |