BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Guerraje
Quartz | Level 8

Screen Shot 2022-04-08 at 10.47.09 AM.png

I am trying to fill out this table of categorical information (ethnicity, smoking status, ..so on) I am asked to use proc freq to do this. The code I have tried is:

Proc freq data= work.query;
by case ethnic sex smoke ;
run;

 

 

The output is below and not in the format I need. I am not sure how to change my code to get the information I am trying to get. 

 

Thank you, 

 

Screen Shot 2022-04-08 at 10.51.54 AM.png

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
Proc freq data= work.query;
tables case*(ethnic sex smoke)/chisq;
run;

 

The CHISQ option gives you the p-values. 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26
Proc freq data= work.query;
tables case*(ethnic sex smoke)/chisq;
run;

 

The CHISQ option gives you the p-values. 

--
Paige Miller
Rick_SAS
SAS Super FREQ

If you want the frequency distribution of each variable by itself, use

 

Proc freq data= work.query;
TABLES case ethnic sex smoke ;
run;

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 862 views
  • 1 like
  • 3 in conversation