Variables can differ in the ODS OUTPUT LSMEANS= data set depending on whether ODS Graphics is on or off


When you specify the ODS OUTPUT LSMEANS= statement in the GLM procedure, the variables in the resulting data set might differ depending on whether ODS Graphics is on or off. This difference could be important if you have subsequent statements that process the variables in the data set. If you do not explicitly turn ODS Graphics on or off in your program statements or if you run the statements in two environments where the default for ODS Graphics is different, it might not be clear which data set form will result. To avoid this problem, include the ODS GRAPHICS ON or ODS GRAPHICS OFF statement in your program statements.

The following two examples fit the same model but produce data sets with different arrangements and variable names for the LS-means. In the first example, ODS Graphics is on.

ods graphics on;
proc glm data=sashelp.class;
   class sex;
   model weight=sex height;
   lsmeans sex ;
   ods output lsmeans=nlsmeans;
   run;
proc print data=nlsmeans;
   run;

The following are the results from the PRINT procedure. Note that the name of the variable containing the LS-means is LSMean and a variable, Dependent, is included that contains the name of the dependent variable.

ObsEffectDependentSexLSMean
1SexWeightF96.541662
2SexWeightM103.162505

 

In the second example, ODS Graphics is off.

ods graphics off;
proc glm data=sashelp.class;
   class sex;
   model weight=sex height;
   lsmeans sex ;
   ods output lsmeans=nlsmeans;
   run;
proc print data=nlsmeans;
   run;

The displayed data set appears next. When ODS Graphics is off, the name of the variable containing the LS-means is WeightLSMean and the Dependent variable is not included.

ObsEffectSexWeightLSMean
1SexF96.541662
2SexM103.162505