LINES and LINESTABLE options to display LS-means differences with lines graphically or in a table


The LINES option in the LSMEANS statement can be used to represent comparisons among LS-means by connecting groups of insignificant means with lines. This makes comparisons between a large number of groups much easier to interpret. Beginning in SAS 9.4 TS1M5 (SAS/STAT® 14.3), the LINES option now displays this graphically. Previously, the results were displayed as a table using letters to group insignificant means. When ODS Graphics is on and you specify the LINES option, the LINES plot is produced instead of the LINES table with letter grouping. To obtain the LINES table with the letter grouping in addition to the graph, use the LINESTABLE option. When ODS Graphics is off, the LINES option produces only the LINES table.

The LSMEANS statement and the LINES and LINESTABLE options are available in many of the modeling procedures available in SAS/STAT. For a list of the supported procedures, see the description of the LSMEANS statement in the Shared Concepts and Topics chapter of the SAS/STAT Users Guide for your release of SAS®.

For example, the following statements produce the LINES plot instead of the LINES table.

   ods graphics on;
   proc glm data=sashelp.class;
      class sex;
      model weight=height sex;
      lsmeans sex / diff lines;
      run;
      quit;

The line connecting the two means in the resulting plot shows that the means do not differ significantly.

weight T grouping for lsmeans for sex

The following statements produce the LINES table.

   ods graphics off;
   proc glm data=sashelp.class;
      class sex;
      model weight=height sex;
      lsmeans sex / diff lines;
      run;
      quit;

Instead of the plot as above, the following LINES table is produced which uses lines made of letters to connect insignificant means. In the table, a line made of the letter A connects the insignificant means.

grouping for lsmeans for sex

These statements produce both the LINES table with letter grouping and the LINES plot.

   ods graphics on;
   proc glm data=sashelp.class;
      class sex;
      model weight=height sex;
      lsmeans sex / diff linestable;
      run;
      quit;

If ODS Graphics is needed to produce other plots but only the LINES table with letter grouping is wanted, use either the PLOTS=NONE option in the LSMEANS statement or add an ODS EXCLUDE statement to suppress the LinesPlot graph. For example, the statements below show two ways to produce diagnostics plots and the LINES table, but suppress the LINES plot. Note that the first approach also suppresses all plots produced by the LSMEANS statement such as the plot of the means (MeanPlot) and the differences plot (DiffPlot) in addition to the LINES plot.

   ods graphics on;
   proc glm data=sashelp.class plots=diagnostics;
      class sex;
      model weight=height sex;
      lsmeans sex / diff linestable plots=none;
      run;
      quit;

The second approach suppresses only the LINES plot.

   ods graphics on;
   proc glm data=sashelp.class plots=diagnostics;
      class sex;
      model weight=height sex;
      lsmeans sex / diff linestable;
      ods exclude LinesPlot;
      run;
      quit;