Learning SAS? Welcome to the exclusive online community for all SAS learners.

Trouble with Tukey

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

Trouble with Tukey

[ Edited ]

Having trouble with this code giving me an output. I think I should be able to run a GLM tukey on just 2 mean values but not getting an ouput. Ideas?

Thanks 

 

Data TukeysAnalysisSexualDimorphism;
input Group $ Nuchal Mastoid Orbit Glabella Mental SN VA SpC Ibrr @@;
datalines;
TB 142.11 183.25 177.18 245.50 207.70 200.92 282.59 246.58 253.36
NA 156.26 193.10 141.82 225.62 172.11 220.40 236.03 236.03 226.79
;
proc glm;
class Group;
model Nuchal = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model Mastoid = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model Orbit = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model Glabella = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model Mental = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model SN = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model VA = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model SpC = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;
proc glm;
class Group;
model Ibrr = Group/solution;
lsmeans Group/pdiff adjust=Tukey;
run;

 

Edit: no need to use an attachment. Post code as advised in https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting


Accepted Solutions
Solution
‎04-11-2018 10:14 AM
Respected Advisor
Posts: 3,249

Re: Trouble with Tukey

Posted in reply to waxenbaum

@waxenbaum wrote:
So you think just remove the lsmeans line and still run proc glm or maybe move to an ANOVA?



I didn't say any of this.

 

Just do the plain old ordinary t-test in the LSMEANS statement.

--
Paige Miller

View solution in original post


All Replies
Respected Advisor
Posts: 3,249

Re: Trouble with Tukey

Posted in reply to waxenbaum

I don't think the Tukey test does anything in the case of 2 levels of a categorical variable, even if SAS would allow it. In the case of only 2 levels, Tukey's test is pointless, it should give the same answer as the regular old t-test. Tukey's test is designed to be a multiple-comparisions test.

--
Paige Miller
Occasional Contributor
Posts: 10

Re: Trouble with Tukey

Posted in reply to PaigeMiller
So you think just remove the lsmeans line and still run proc glm or maybe move to an ANOVA?


Solution
‎04-11-2018 10:14 AM
Respected Advisor
Posts: 3,249

Re: Trouble with Tukey

Posted in reply to waxenbaum

@waxenbaum wrote:
So you think just remove the lsmeans line and still run proc glm or maybe move to an ANOVA?



I didn't say any of this.

 

Just do the plain old ordinary t-test in the LSMEANS statement.

--
Paige Miller
Occasional Contributor
Posts: 10

Re: Trouble with Tukey

Posted in reply to PaigeMiller
Thank you!


Super User
Posts: 10,530

Re: Trouble with Tukey

Posted in reply to waxenbaum

Hmmm. I get lots of output:

27         Data TukeysAnalysisSexualDimorphism;
28         input Group $ Nuchal Mastoid Orbit Glabella Mental SN VA SpC Ibrr;
29         datalines;

NOTE: The data set WORK.TUKEYSANALYSISSEXUALDIMORPHISM has 2 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      
32         ;

33         proc glm;
34         class Group;
35         model Nuchal = Group/solution;
36         lsmeans Group/pdiff adjust=Tukey;
37         run;


NOTE: The PROCEDURE GLM printed pages 1-3.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds
      
38         proc glm;

39         class Group;
40         model Mastoid = Group/solution;
41         lsmeans Group/pdiff adjust=Tukey;
42         run;


2                                                          Das SAS System                            15:59 Wednesday, April 11, 2018

NOTE: The PROCEDURE GLM printed pages 4-6.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds
      
43         proc glm;

44         class Group;
45         model Orbit = Group/solution;
46         lsmeans Group/pdiff adjust=Tukey;
47         run;


NOTE: The PROCEDURE GLM printed pages 7-9.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.11 seconds
      cpu time            0.01 seconds
      
48         proc glm;

49         class Group;
50         model Glabella = Group/solution;
51         lsmeans Group/pdiff adjust=Tukey;
52         run;


NOTE: The PROCEDURE GLM printed pages 10-12.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.08 seconds
      cpu time            0.02 seconds
      
53         proc glm;

54         class Group;
55         model Mental = Group/solution;
56         lsmeans Group/pdiff adjust=Tukey;
57         run;


NOTE: The PROCEDURE GLM printed pages 13-15.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.08 seconds
      cpu time            0.01 seconds
      
58         proc glm;

59         class Group;
60         model SN = Group/solution;
61         lsmeans Group/pdiff adjust=Tukey;
62         run;


NOTE: The PROCEDURE GLM printed pages 16-18.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.10 seconds
      cpu time            0.01 seconds
      
63         proc glm;
3                                                          Das SAS System                            15:59 Wednesday, April 11, 2018


64         class Group;
65         model VA = Group/solution;
66         lsmeans Group/pdiff adjust=Tukey;
67         run;


NOTE: The PROCEDURE GLM printed pages 19-21.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds
      
68         proc glm;

69         class Group;
70         model SpC = Group/solution;
71         lsmeans Group/pdiff adjust=Tukey;
72         run;


NOTE: The PROCEDURE GLM printed pages 22-24.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.06 seconds
      cpu time            0.02 seconds
      
73         proc glm;

74         class Group;
75         model Ibrr = Group/solution;
76         lsmeans Group/pdiff adjust=Tukey;
77         run;

78         
79         GOPTIONS NOACCESSIBLE;
80         %LET _CLIENTTASKLABEL=;
81         %LET _CLIENTPROCESSFLOWNAME=;
82         %LET _CLIENTPROJECTPATH=;
83         %LET _CLIENTPROJECTPATHHOST=;
84         %LET _CLIENTPROJECTNAME=;
85         %LET _SASPROGRAMFILE=;
86         %LET _SASPROGRAMFILEHOST=;
87         
88         ;*';*";*/;quit;

NOTE: The PROCEDURE GLM printed pages 25-27.
NOTE: PROZEDUR GLM used (Total process time):
      real time           0.09 seconds
      cpu time            0.01 seconds
      
88       !                run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 10

Re: Trouble with Tukey

Posted in reply to KurtBremser
Yeah, I get output but no p-values.


Super User
Posts: 13,876

Re: Trouble with Tukey

Posted in reply to waxenbaum

@waxenbaum wrote:
Yeah, I get output but no p-values.



No variability in the example data for the group with only one record. So nothing to develop distribution or probability from.

Try this data set which adds some smallish random values:

Data work.TukeysAnalysisSexualDimorphism;
input Group $ Nuchal Mastoid Orbit Glabella Mental SN VA SpC Ibrr ;
array vars Nuchal Mastoid Orbit Glabella Mental SN VA SpC Ibrr;
output;
do i=1 to 13;
   do j=1 to dim(vars);
   vars[j] = vars[j]+ rand('uniform');
   end;
   output;
end;   
drop i j;
datalines;
TB 142.11 183.25 177.18 245.50 207.70 200.92 282.59 246.58 253.36
NA 156.26 193.10 141.82 225.62 172.11 220.40 236.03 236.03 226.79
;

 

Which will have some of the p-values. But you don't say which specific ones you are interested in.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 214 views
  • 0 likes
  • 4 in conversation