Hello,
I need some assistance with creating a frequency table of smoking status by cholesterol status suppress the Row Pct and Col Pct
This is what I have to create a frequency table for smoking status however
proc freq data=sashelp.heart;
tables Smoking_Status/Chol_Status;
quit;
I tried to use example
proc freq data=SummerSchool order=data; tables Internship*Enrollment / chisq; weight Count; run;
However I'm not getting smoking status by cholesterol status
Status Smoking_Status Chol_Status
dead Heavy (16-25) desirable
alive non-smoker desirable
dead moderate (16-25) high
alive non-smoker borderline
alive light (1-5) borderline
tables Internship*Enrollment / chisq nocol norow;
Please go back to your first post in this thread and provide a more meaningful title.
@lisa2002 wrote:
Hello,
I need some assistance with creating a frequency table of smoking status by cholesterol status suppress the Row Pct and Col Pct
This is what I have to create a frequency table for smoking status however
proc freq data=sashelp.heart;
tables Smoking_Status/Chol_Status;
quit;
I tried to use example
proc freq data=SummerSchool order=data; tables Internship*Enrollment / chisq; weight Count; run;However I'm not getting smoking status by cholesterol status
Status Smoking_Status Chol_Status
dead Heavy (16-25) desirable
alive non-smoker desirable
dead moderate (16-25) high
alive non-smoker borderline
alive light (1-5) borderline
Smoking_Status is not included in your PROC FREQ so it won't be included in the results. It depends on how you want it, but you could just add smoking_status to the table statement or put it as a BY statement to have it done for each status.
Your code:
proc freq data=sashelp.heart; tables Smoking_Status/Chol_Status; quit;
generates errors because the / is used to indicate options such as the types of tests or output are required.
The * between variable names is used to request a cross-tabulation
proc freq data=sashelp.heart; tables Smoking_Status*Chol_Status; quit;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.