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;

 

 

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!
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
  • 1164 views
  • 0 likes
  • 2 in conversation