BookmarkSubscribeRSS Feed
knighsson
Obsidian | Level 7

Hello.

 

I want to get a table as follows: (this is the proc means results)

111111111111.PNG

 

however, when I used proc surveymeans, code are below

proc surveymeans data=nh.outcomes;
   STRATA sdmvstra;  
CLUSTER sdmvpsu;  
var BMXBMI;
CLASS alpha16; 
WEIGHT glucwt4yr;
domain eligible;
run;

I only get the table like this:

22222222222.PNG

 

could you please tell what went wrong?

 

Thank you!

 

3 REPLIES 3
knighsson
Obsidian | Level 7
In my code, I have two domains (eligible=1 or 2), but when I changed my code,

proc surveymeans data=nh.outcomes_joint_240 nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
var BMXBMI;
CLASS alpha16 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
domain eligible;
by alpha16;
run;
it did not work as well. then I changed the code like below, it worked.

proc surveymeans data=nh.outcomes_joint_240 nomcar;
STRATA sdmvstra;
CLUSTER sdmvpsu;
var BMXBMI;
CLASS alpha16 age RIAGENDR PIR SDDSRVYR RIDRETH1;
WEIGHT glucwt4yr;
domain alpha16;
run;

But I wonder is this the right code since I did not use my domain variable.

Thank you!
PGStats
Opal | Level 21

I think the problem with the first code version is the BY statement. It requests a separate analysis for each value of alpha16. Try keeping the DOMAIN eligible statement but dropping the BY statement.

 

You will also need the MISSING option in the proc surveymeans statement, otherwise your eligible=2 domain will be ignored.

PG
knighsson
Obsidian | Level 7
the eligible domain has been defined as follows:

data nh.outcomes;
set nh.outcome;
if alpha16=. then eligible=2;
else eligible=1;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 1142 views
  • 0 likes
  • 2 in conversation