BookmarkSubscribeRSS Feed
bobryan22
Calcite | Level 5

Hello!

 

Sorry if this is a remedial question but I'm learning SAS for a project and I'm having some trouble going from given proc logistic code (shown below) to using proc genmod instead. Any help would be appreciated!

 

 

proc logistic data=data;
class x1(ref="1")/param=ref;
class x2(ref="2")/param=ref;
class x3(ref="3")/param=ref
weight x4;
model y(event='1') = x1
x2
x3
x4
x5
x4 * x2
x5 * x3
/stb; output out=output.blah predicted=pred; ods output parameterestimates = output.par_blah; run;

 

1 REPLY 1
Rick_SAS
SAS Super FREQ

You might want to acquaint yourself with the SASHELP data sets, which enable you to post examples that use real data that everyone can access. For example, see

SAS/STAT example data sets

SASHELP Data Sets

 

You should also bookmark the SAS/STAT documentation.

 

/* show variables for sashelp.heart */
proc contents data=sashelp.heart varnum; run;

/* show levels of categorical variables for sashelp.heart */
proc freq data=sashelp.heart;
tables sex BP_Status Chol_Status;
run;

ods select parameterestimates;
proc logistic data=sashelp.heart;
   class BP_Status(ref="Normal")/param=ref;
   class Chol_Status(ref="Desirable")/param=ref;
   model Sex(event='Female') = BP_Status 
   Chol_Status Weight Diastolic*Chol_Status
   ;
   output out=blah predicted=pred;
   ods output parameterestimates = par_blah;
run;

ods select parameterestimates;
proc genmod data=sashelp.heart;
   class BP_Status(ref="Normal")/param=ref;
   class Chol_Status(ref="Desirable")/param=ref;
   model Sex(event='Female') = BP_Status 
   Chol_Status Weight Diastolic*Chol_Status
   / dist=bin;
   output out=blah2 predicted=pred;
   ods output parameterestimates = par_blah2;
run;

/* compare predicted values to show they are approximately equal */
proc compare base=blah compare=blah2 method=absolute criterion=1e-8; 
run;

 

 

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
  • 1 reply
  • 1107 views
  • 0 likes
  • 2 in conversation