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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1413 views
  • 1 like
  • 3 in conversation