BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ChuksManuel
Pyrite | Level 9

Hi all,

 

I am trying to calculate age and sex prevalence rate for hypertension by survey year. Is there a way I can include age and sex variables in proc surveyfreq procedure?

proc surveyfreq data=final_control;
weight LLCPWT_F;
strata _ststr;
cluster _psu;
tables year*hypertension/row col cl chisq; 
run;

 Age and sex are categorical variables.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Try

proc surveyfreq data=final_control;
weight LLCPWT_F;
strata _ststr;
cluster _psu;
tables (sex race) * year*hypertension/row col cl chisq; 
/* or */
tables year*(sex race) * hypertension/row col cl chisq; run;

Parentheses group variables as to positions in resulting tables. I find that with multidimensional results, sex*year*hypertension is 3 dimensions, that often sending the results to a data sets and using a report procedure to control output gets nicer appearance for interpretation.

Order of variables would differ if you want all sexes within year or all years within sex levels. I often find doing multiple orders is helpful in preparing write-ups of results.

 

If the variable Hypertension is a 1/0 coded numeric variable I might look at SURVEYMEANS with Sex, Race and Year as DOMAIN { (sex race)*year to get the results for those combinations} variables and look at the Mean and Sum of Hypertension. The Mean of a 1/0 coded variable is the percentage of 1's and Sum is the number of 1's. Which may be easier to read for the percentages and, if of interest, the number of Hypertension cases.

But still use ODS OUTPUT to make data sets to build nice report tables.

 


@ChuksManuel wrote:

Hi all,

 

I am trying to calculate age and sex prevalence rate for hypertension by survey year. Is there a way I can include age and sex variables in proc surveyfreq procedure?

proc surveyfreq data=final_control;
weight LLCPWT_F;
strata _ststr;
cluster _psu;
tables year*hypertension/row col cl chisq; 
run;

 Age and sex are categorical variables.

 


 

View solution in original post

2 REPLIES 2
ballardw
Super User

Try

proc surveyfreq data=final_control;
weight LLCPWT_F;
strata _ststr;
cluster _psu;
tables (sex race) * year*hypertension/row col cl chisq; 
/* or */
tables year*(sex race) * hypertension/row col cl chisq; run;

Parentheses group variables as to positions in resulting tables. I find that with multidimensional results, sex*year*hypertension is 3 dimensions, that often sending the results to a data sets and using a report procedure to control output gets nicer appearance for interpretation.

Order of variables would differ if you want all sexes within year or all years within sex levels. I often find doing multiple orders is helpful in preparing write-ups of results.

 

If the variable Hypertension is a 1/0 coded numeric variable I might look at SURVEYMEANS with Sex, Race and Year as DOMAIN { (sex race)*year to get the results for those combinations} variables and look at the Mean and Sum of Hypertension. The Mean of a 1/0 coded variable is the percentage of 1's and Sum is the number of 1's. Which may be easier to read for the percentages and, if of interest, the number of Hypertension cases.

But still use ODS OUTPUT to make data sets to build nice report tables.

 


@ChuksManuel wrote:

Hi all,

 

I am trying to calculate age and sex prevalence rate for hypertension by survey year. Is there a way I can include age and sex variables in proc surveyfreq procedure?

proc surveyfreq data=final_control;
weight LLCPWT_F;
strata _ststr;
cluster _psu;
tables year*hypertension/row col cl chisq; 
run;

 Age and sex are categorical variables.

 


 

StatDave
SAS Super FREQ

One way to do this is with a model-based approach using PROC SURVEYLOGISTIC that includes sex and age along with year in the model on hypertension. Include sex, age, and year in a CLASS statement using the PARAM=GLM option. Also include year in an LSMEANS statement with the ILINK option to estimate the adjusted hypertension proportions for each year. If comparisons among the years are desired, then you can add the NLMeans macro. This can be done in the same way as is shown with PROC LOGISTIC in this note.

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!

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
  • 2 replies
  • 1079 views
  • 1 like
  • 3 in conversation