Unless the sample sizes of the age groups are fixed, that is part of your study design, then you should not use a WHERE statement. My suggestion to avoid the issue is to set all the response variables for the group that you are NOT interested in to missing and then use the NOMCAR option on the SURVEYLOGISTIC statement. This will give you a valid subgroup analysis (since the NOMCAR option treats missing values as a subgroup) and fit only the model you are interested in.
The DOMAIN statement requests analysis for each level/domain in your domain variable. In your case you have two domains: 1(Age 18-45) and 0(outside age 18-45).
The where statement simply excludes observations where the condition in the where statement is not satisfied.
Provide some sample of your data if you want a more usable answer 🙂
Also consult the PROC SURVEYLOGISTIC Documentation
Unless the sample sizes of the age groups are fixed, that is part of your study design, then you should not use a WHERE statement. My suggestion to avoid the issue is to set all the response variables for the group that you are NOT interested in to missing and then use the NOMCAR option on the SURVEYLOGISTIC statement. This will give you a valid subgroup analysis (since the NOMCAR option treats missing values as a subgroup) and fit only the model you are interested in.
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!
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.