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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 589 views
  • 1 like
  • 3 in conversation