Programming the statistical procedures from SAS

Proc logistic to proc genmod code

Reply
New User
Posts: 1

Proc logistic to proc genmod code

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;

 

SAS Super FREQ
Posts: 4,240

Re: Proc logistic to proc genmod code

Posted in reply to bobryan22

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;

 

 

Ask a Question
Discussion stats
  • 1 reply
  • 106 views
  • 0 likes
  • 2 in conversation