- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
The class statement doesn't work in the syntax below.
PROC SURVEYMEANS Data=health varmethod=brr mean clm;
CLASS sex agegroup;
REPWEIGHTS Rweight1-Rweight500;
VAR Cause;
WEIGHT TWeight ;
ods output Statistics=MyStat1 (keep= VarLevel Mean LowerCLMean StdErr UpperCLMean sex agegroup);
run;
The output contents only the total estimations.
Any helps will be appreciated.
Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want to have a summary of the variable Cause for levels of the variables Sex and Agegroup then you want to use a DOMAIN statement in Surveymeans.
Compare the output for these two calls that you can run as you should have the SAS supplied SASHELP.CLASS data set:
proc surveymeans data=sashelp.class; class sex age; var height; run; proc surveymeans data=sashelp.class; domain sex age; var height; run;
And compare these for the intended use of CLASS when you want analysis of the levels of a variable.
proc surveymeans data=sashelp.class; var age; run; proc surveymeans data=sashelp.class; class age; var age; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi. I don't receive any errors, except the warning: "The variable diverse in the Drop, Keep, or Rename list has never been referenced."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, i meant the variable "sex" . Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you want to have a summary of the variable Cause for levels of the variables Sex and Agegroup then you want to use a DOMAIN statement in Surveymeans.
Compare the output for these two calls that you can run as you should have the SAS supplied SASHELP.CLASS data set:
proc surveymeans data=sashelp.class; class sex age; var height; run; proc surveymeans data=sashelp.class; domain sex age; var height; run;
And compare these for the intended use of CLASS when you want analysis of the levels of a variable.
proc surveymeans data=sashelp.class; var age; run; proc surveymeans data=sashelp.class; class age; var age; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. Why do i need to use "Domain" instead of Class. Domain makes a subpopulation, while what I need is to create the estimations by the categories of the variable in CLASS - That's what CLASS statement does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please read your initial message carefully. You do not say anything about what you actually wanted for output just claimed that "class doesn't work".
I went with a suggestion of DOMAIN as that is a frequent request for that type of output and one of the possible interpretations because of the way CLASS works in other procedures such as MEANS/Summary, Tabulate and others.
So you needed to add the CLASS variables to the VAR statement to get the levels of those variables. I did show how to do that as well.
Hello.
The class statement doesn't work in the syntax below.
PROC SURVEYMEANS Data=health varmethod=brr mean clm; CLASS sex agegroup; REPWEIGHTS Rweight1-Rweight500; VAR Cause; WEIGHT TWeight ; ods output Statistics=MyStat1 (keep= VarLevel Mean LowerCLMean StdErr UpperCLMean sex agegroup); run;
The output contents only the total estimations.
Any helps will be appreciated.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response, and I apologize for not explaining it clearly at the beginning.
I was concerned that the "domain" statement might function like the "by" statement, treating each subgroup independently. However, it seems that is not the case. So, I will use the "domain" statement. Thank you very much!
I still don't understand why the "class" statement doesn't work. Is the "class" statement only for categorical variables?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If a numeric variable appears on the VAR statement then it will only have the requested statistics mean or what ever. However when a variable appears on the CLASS statement and the VAR statement then levels of the variable are summarized. Class is used to force categorical behavior when you want it but only for variables on the VAR statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for the explanation.