When you use an ODS output statement to create SAS data sets for certain tables in PROC SURVEYMEANS, there are two possible types of table structure for the output data sets: rectangular and stacking. A rectangular structure creates one observation for each analysis variable in the data set. A stacking structure creates only one observation in the output data set for all analysis variables.
Before SAS 9, the stacking table structure, similar to the table structure in PROC MEANS, was the default in PROC SURVEYMEANS. Since SAS 9, the new default is to produce a rectangular table in the output data sets. You can use the STACKING option to request that the procedure produce the output data sets by using a stacking table structure.
The STACKING option affects the following tables:
Domain
Ratio
Statistics
StrataInfo
Figure 88.6 and Figure 88.7 shows these two structures for analyzing the following data set:
data new; input sex$ x; datalines; M 12 F 5 M 13 F 23 F 11 ;
The following statements request the default rectangular structure of the output data set for the statistics table:
proc surveymeans data=new mean; ods output statistics=rectangle; run; proc print data=rectangle; run;
Figure 88.6 shows the rectangular structure.
Rectangular Structure in the Output Data Set |
Obs | VarName | VarLevel | Mean | StdErr |
---|---|---|---|---|
1 | x | 12.800000 | 2.905168 | |
2 | sex | F | 0.600000 | 0.244949 |
3 | sex | M | 0.400000 | 0.244949 |
The following statements specify the STACKING option to request that the output data set have a stacking structure:
proc surveymeans data=new mean stacking; ods output statistics=stacking; run; proc print data=stacking; run;
Figure 88.7 shows the stacking structure of the output data set for the statistics table requested by the STACKING option.
Stacking Structure in the Output Data Set |
Obs | x | x_Mean | x_StdErr | sex_F | sex_F_Mean | sex_F_StdErr | sex_M | sex_M_Mean | sex_M_StdErr |
---|---|---|---|---|---|---|---|---|---|
1 | x | 12.800000 | 2.905168 | sex=F | 0.600000 | 0.244949 | sex=M | 0.400000 | 0.244949 |