BookmarkSubscribeRSS Feed
lc7033907
Obsidian | Level 7

Hello all,

 

I want to use sashelp.class as an example to get mean and SE (standard error) values of height by proc mixed and I like to save these values in a dataset.  I found all the SE values are the exactly the same. This is my first time to touch proc mixed, so I really get confused. Anyone can give me some  explanation? Thanks.

 

proc mixed data=sashelp.class(where=(Age in (14,15)));
  class Sex  Age;
  model Height = Sex  Age;
    lsmeans Sex  Age;
run;

Here is output:mixed_output.PNG

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I think that's what is supposed to happen with the SE when you estimate some type of linear model for the two-way ANOVA case, and there are equal number of observations in each cell. 

--
Paige Miller
lc7033907
Obsidian | Level 7

Hi @PaigeMiller , anyway to correct it, because I guess those numbers should not be equal. Thanks.

PaigeMiller
Diamond | Level 26

@lc7033907 wrote:

Hi @PaigeMiller , anyway to correct it, because I guess those numbers should not be equal. Thanks.


You are incorrect. The SE numbers should be equal in this example.

--
Paige Miller
lc7033907
Obsidian | Level 7

@PaigeMiller Thank you. Now let me modify my real problem  and I hope to get some hints. The following is data that I have

data have;
input subjid $2.   Avisitc $3-10 trt $ CHG;
datalines;
1 week 12 A 3.7
1 week 16 A 4.8
2 week 12 B -2
2 week 16 B -2.2
3 week 12 A -3
3 week 16 A -2.5
4 week 12 B 2.8
4 week 16 B 3.0
5 week 12 A 7.0
5 week 16 A 7.1
6 week 12 B 6.4
6 week 16 B 6.8
7 week 12 A -5
7 week 16 A -5.4
8 week 12 B 10
8 week 16 B 11
9 week 12 B -6.4
9 week 16 B -7.1
10 week 12 A 6.3
10 week 16 A 6.9
;

I want to get a report in the following:

report_want.PNG

 Now I have trouble on the last column, because I never use proc mixed before. Any hints are appreciated. Thanks.

PaigeMiller
Diamond | Level 26

You can get most of this from PROC MIXED

 

ods select lsmeans;
proc mixed data=have;
    class avisitc trt;
    model chg = avisitc*trt;
    lsmeans avisitc*trt;
run;
quit;

If it has to be displayed EXACTLY as shown, then that is a job for other PROCs, and I would recommend you start another thread to discuss how to display results exactly in the desired report form.

 

 

--
Paige Miller
lc7033907
Obsidian | Level 7

Thank you so much @PaigeMiller . Your code is exactly the same as what I did on my own. Since I got the same values on SE, I thought I was wrong. Thank you once again.

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 905 views
  • 2 likes
  • 2 in conversation