BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
CarlFritz
Calcite | Level 5

I have run the same SAS program for years to use Proc GLM with the LSMEANS statement and the LINES option.  I don't think I have made any changes to the Proc GLM code but recently the LINES option has not been working.  I am stumped.  I have tried all three variations of the LSMEANS statements shown below (and other variations as well).  Each lsmeans statement produces the same output (as expected) but without the results of the LINES option.  In the example code below, SAMPLE is a character variable with 5 levels.  The standard errors for the 5 means are equal.   My objective with this code is to run a one-way ANOVA with pairwise t-tests (Fisher's LSD) and to display the means with lines that connect means that are not statistically significant at the 0.10 alpha level.  Any suggestions?

 

proc glm data=two ;
by attr;
class sample;
model score = sample / ss3;
lsmeans sample / stderr pdiff=all adjust=t alpha=0.10 lines; * out=lsmeans;
lsmeans sample / stderr pdiff alpha=0.10 lines;
lsmeans sample / stderr pdiff adjust=t alpha=0.10 lines;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Beginning in SAS 9.4M5, the tabular output from the LINES option was replaced by a graph. See

the article, "Graphs for multiple comparisons of means: The lines plot"

 

If you want tabular output, use the  LINESTABLE option. This is discussed in the documentation of the LINES option on the LSMEANS statement.

View solution in original post

4 REPLIES 4
ballardw
Super User

"Not working" is awful vague.

Are there errors or unusual messages in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

CarlFritz
Calcite | Level 5

Hi ballardw,

 

Thank you for your reply.  Yes, I guess that "not working" is awful vague.  What I meant was that the LINES option is not producing any output in addition to output produced by other options in the LSMEANS statement.  There is no list of means in descending order with lines connecting means that are not statistically significant at alpha=0.10.

 

There are no error messages or unexpected comments in the SAS log.  The SAS log does produce a warning message that "ADJUST=T implies no adjustment for simultaneous inference.", but that message is expected.

The output from the program is what I would expect from the SAS code except that the LINES option does not produce the list of means annotated with vertical lines.

I have copied a simplified version of the complete SAS program below, along with the SAS log and output.  I have also attached to this message the same SAS program, log and output copied as text into a .SAS file.  The PROC GLM in this code uses a BY variable "attr" that has 5 values in the data.  I copied the output from only the first value of the BY variable: "attr=1".  The data used in this example are embedded in the SAS program below.  

 

*SAS PROGRAM;

options formdlim='-';

 

data two; 

 * INFILE datain1 dsd dlm="," firstobs=3;

  input id $ sample $ @;

  do attr= 1 to 5 by 1;

     input score @ ;

       output;

  end;

datalines;

10001B A540 8 8 7 5 4

10001B B303 8 8 7 7 6

10001B C855 9 8 9 9 8

10001B D163 8 8 7 7 8

10001B E692 7 8 6 8 7

10002K B303 6 4 2 1 1

10002K A540 5 5 4 5 6

10002K D163 5 5 7 7 7

10002K C855 6 5 2 5 5

10002K E692 8 3 6 2 8

10003E C855 8 8 7 8 8

10003E D163 7 7 8 8 8

10003E A540 8 8 9 9 9

10003E B303 8 8 8 8 8

10003E E692 8 7 3 2 2

10004P D163 3 4 7 7 8

10004P C855 8 9 8 9 9

10004P B303 6 5 5 5 9

10004P A540 7 6 7 8 9

10004P E692 2 4 6 6 8

;

run;

 

proc sort data=two;

by attr;

 

proc glm data=two;

by attr;

class sample;

model score = sample / ss3;

lsmeans sample / stderr pdiff=all adjust=t alpha=0.10 lines out=lsmeans;

lsmeans sample / stderr pdiff alpha=0.10 lines;

lsmeans sample / stderr pdiff adjust=t alpha=0.10 lines;

title;

run;

 

quit;

 

*SAS LOG;

1793  options formdlim='-';

1794

1795  data two;

1796   * INFILE datain1 dsd dlm="," firstobs=3;

1797    input id $ sample $ @;

1798    do attr= 1 to 5 by 1;

1799       input score @ ;

1800       output;

1801    end;

1802  datalines;

 

NOTE: The data set WORK.TWO has 100 observations and 4 variables.

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

 

 

1823  ;

1824  run;

1825

1826  proc sort data=two;

1827  by attr;

1828

 

NOTE: There were 100 observations read from the data set WORK.TWO.

NOTE: The data set WORK.TWO has 100 observations and 4 variables.

NOTE: PROCEDURE SORT used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

 

 

1829  proc glm data=two;

1830  by attr;

1831  class sample;

1832  model score = sample / ss3;

1833  lsmeans sample / stderr pdiff=all adjust=t alpha=0.10 lines out=lsmeans;

1834  lsmeans sample / stderr pdiff alpha=0.10 lines;

1835  lsmeans sample / stderr pdiff adjust=t alpha=0.10 lines;

1836  title;

1837  run;

 

NOTE: Interactivity disabled with BY processing.

WARNING: ADJUST=T implies no adjustment for simultaneous inference.

NOTE: The above message was for the following BY group:

      attr=1

WARNING: ADJUST=T implies no adjustment for simultaneous inference.

NOTE: The above message was for the following BY group:

      attr=2

WARNING: ADJUST=T implies no adjustment for simultaneous inference.

NOTE: The above message was for the following BY group:

      attr=3

WARNING: ADJUST=T implies no adjustment for simultaneous inference.

NOTE: The above message was for the following BY group:

      attr=4

WARNING: ADJUST=T implies no adjustment for simultaneous inference.

NOTE: The above message was for the following BY group:

      attr=5

NOTE: The data set WORK.LSMEANS has 25 observations and 5 variables.

NOTE: PROCEDURE GLM used (Total process time):

      real time           5.50 seconds

      cpu time            2.31 seconds

 

 

1838

1839  quit;

 

 

*SAS OUTPUT;

attr=1

 

The GLM Procedure

 

             Class Level Information

 

Class         Levels    Values

 

sample             5    A540 B303 C855 D163 E692

 

 

Number of Observations Read          20

Number of Observations Used          20

 

--------------------------------------------------------------------------------------------------------------------------

 

attr=1

 

The GLM Procedure

 

Dependent Variable: score

 

                                        Sum of

Source                      DF         Squares     Mean Square    F Value    Pr > F

 

Model                        4      9.50000000      2.37500000       0.66    0.6313

 

Error                       15     54.25000000      3.61666667

 

Corrected Total             19     63.75000000

 

 

R-Square     Coeff Var      Root MSE    score Mean

 

0.149020      28.17413      1.901754      6.750000

 

 

Source                      DF     Type III SS     Mean Square    F Value    Pr > F

 

sample                       4      9.50000000      2.37500000       0.66    0.6313

 

--------------------------------------------------------------------------------------------------------------------------

 

attr=1

 

The GLM Procedure

Least Squares Means

 

                              Standard                  LSMEAN

sample    score LSMEAN           Error    Pr > |t|      Number

 

A540        7.00000000      0.95087679      <.0001           1

B303        7.00000000      0.95087679      <.0001           2

C855        7.75000000      0.95087679      <.0001           3

D163        5.75000000      0.95087679      <.0001           4

E692        6.25000000      0.95087679      <.0001           5

 

 

                  Least Squares Means for effect sample

                   Pr > |t| for H0: LSMean(i)=LSMean(j)

 

                        Dependent Variable: score

 

i/j              1             2             3             4             5

 

   1                      1.0000        0.5853        0.3673        0.5853

   2        1.0000                      0.5853        0.3673        0.5853

   3        0.5853        0.5853                      0.1577        0.2822

   4        0.3673        0.3673        0.1577                      0.7152

   5        0.5853        0.5853        0.2822        0.7152

 

 

NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.

 

--------------------------------------------------------------------------------------------------------------------------

 

attr=1

 

The GLM Procedure

Least Squares Means

 

                              Standard                  LSMEAN

sample    score LSMEAN           Error    Pr > |t|      Number

 

A540        7.00000000      0.95087679      <.0001           1

B303        7.00000000      0.95087679      <.0001           2

C855        7.75000000      0.95087679      <.0001           3

D163        5.75000000      0.95087679      <.0001           4

E692        6.25000000      0.95087679      <.0001           5

 

 

                  Least Squares Means for effect sample

                   Pr > |t| for H0: LSMean(i)=LSMean(j)

 

                        Dependent Variable: score

 

i/j              1             2             3             4             5

 

   1                      1.0000        0.5853        0.3673        0.5853

   2        1.0000                      0.5853        0.3673        0.5853

   3        0.5853        0.5853                      0.1577        0.2822

   4        0.3673        0.3673        0.1577                      0.7152

   5        0.5853        0.5853        0.2822        0.7152

 

 

NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.

 

--------------------------------------------------------------------------------------------------------------------------

 

attr=1

 

The GLM Procedure

Least Squares Means

 

                              Standard                  LSMEAN

sample    score LSMEAN           Error    Pr > |t|      Number

 

A540        7.00000000      0.95087679      <.0001           1

B303        7.00000000      0.95087679      <.0001           2

C855        7.75000000      0.95087679      <.0001           3

D163        5.75000000      0.95087679      <.0001           4

E692        6.25000000      0.95087679      <.0001           5

 

 

                  Least Squares Means for effect sample

                   Pr > |t| for H0: LSMean(i)=LSMean(j)

 

                        Dependent Variable: score

 

i/j              1             2             3             4             5

 

   1                      1.0000        0.5853        0.3673        0.5853

   2        1.0000                      0.5853        0.3673        0.5853

   3        0.5853        0.5853                      0.1577        0.2822

   4        0.3673        0.3673        0.1577                      0.7152

   5        0.5853        0.5853        0.2822        0.7152

 

 

NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.

 

Rick_SAS
SAS Super FREQ

Beginning in SAS 9.4M5, the tabular output from the LINES option was replaced by a graph. See

the article, "Graphs for multiple comparisons of means: The lines plot"

 

If you want tabular output, use the  LINESTABLE option. This is discussed in the documentation of the LINES option on the LSMEANS statement.

CarlFritz
Calcite | Level 5

Thank you very much Rick.  I was looking at documentation for SAS9.3 and I don't usually have ODS graphics turned on so I wasn't aware of the change.  I was totally stumped.  I appreciate your answer and the links in your reply.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1170 views
  • 1 like
  • 3 in conversation