More Basics
The "id" statement
Alternatively, a variable can be substituted for the obs column using the id command.
proc print data=one;
var name sex age;
id studyid;
run;
The id statement in proc print is helpful when printing so many variables that the output does not fit on one page. Using the id statement will ensure that the id variable specified is on each page of the output.
The output shown in the original example above is what you see in the results window. The output in the output window looks like this:
If you want to copy output from SAS to paste into a Word document, you can select and copy from the results window. This will look like this:
In a later lecture, we will show you how to extract the results so they look as nice as they do in the results window!
Note that the var statement is not required. If it is omitted, SAS will, by default, print all the variables in the data set.
proc print data=one;
run;
Proc Means
proc means produces descriptive statistics on continuous variables: mean, standard deviation, etc.
proc means data=name <options>;
var varl var2;
run;
Example:
proc means data=one;
var age;
run;
Again, if we omit the var statement, SAS will provide results for all (continuous) variables.
proc means data=one;
run;
We can also select specific statistics to be calculated and displayed. These include the default statistics, N, Mean, Std, Min, Max, and others, such as Median, Q1, and Q3. Here, we ask for just N, Mean and Median to be displayed :
proc means data=one n mean median;
var age;
run;