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

Hi!  I'm wondering if there is an option to include in the Proc Logistic preocedure that would output the number of observations used for each variable?

 

for example, if i am using gender as an independent variable, can I add something to the procedure that would output # males and # female observations in addition to all the statistical output?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

You will easily get some useful information (means, frequencies) in proc logistic with option SIMPLE.

 

proc logistic data=sashelp.heart simple;
class sex smoking_status;
model status = sex smoking_status weight;
run;

every table can be captured with ODS OUTPUT. 

PG

View solution in original post

5 REPLIES 5
Reeza
Super User

Not AFAIK, in general, I run a proc freq/means ahead of time to get a table of characteristics. 

 

Here's one way to get several proc freq results into a nice table at once:

https://gist.github.com/statgeek/e0903d269d4a71316a4e

 

/*This code is an example of how to generate a table with 
Variable Name, Variable Value, Frequency, Percent, Cumulative Freq and Cum Pct
No macro's are required
Use Proc Freq to generate the list, list variables in a table statement if only specific variables are desired
Use ODS Table to capture the output and then format the output into a printable table.
*/

*Run frequency for tables;
ods table onewayfreqs=temp;
proc freq data=sashelp.class;
	table sex age;
run;

*Format output;
data want;
length variable $32. variable_value $50.;
set temp;
Variable=scan(table, 2);

Variable_Value=strip(trim(vvaluex(variable)));

keep variable variable_value frequency percent cum:;
label variable='Variable' 
	variable_value='Variable Value';
run;

*Display;
proc print data=want(obs=20) label;
run;
PGStats
Opal | Level 21

You will easily get some useful information (means, frequencies) in proc logistic with option SIMPLE.

 

proc logistic data=sashelp.heart simple;
class sex smoking_status;
model status = sex smoking_status weight;
run;

every table can be captured with ODS OUTPUT. 

PG
Reeza
Super User

Learn something new every day 😉

PGStats
Opal | Level 21

So do I Smiley Happy

PG
SteveDenham
Jade | Level 19

Mostly from you two Smiley Happy

 

Steve Denham

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 2158 views
  • 6 likes
  • 4 in conversation