- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 12-26-2020 05:36 PM
(1380 views)
Hello.
I want to get a table as follows: (this is the proc means results)
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:
could you please tell what went wrong?
Thank you!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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!
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
the eligible domain has been defined as follows:
data nh.outcomes;
set nh.outcome;
if alpha16=. then eligible=2;
else eligible=1;
run;
data nh.outcomes;
set nh.outcome;
if alpha16=. then eligible=2;
else eligible=1;
run;