Desktop productivity for business analysts and programmers

How do I use either PROC LOGISTIC or PROC GENMOD to create a logistic model without an explanatory variable?

Reply
Contributor
Posts: 50

How do I use either PROC LOGISTIC or PROC GENMOD to create a logistic model without an explanatory variable?

I am trying to figure out how to create a logistic model that has no explanatory variables (to act a my "null model).  Can I do this using either PROC LOGISTIC or PROC GENMOD?

I have included my coding below for:

  • The logistic model with no explanatory variable (DOESN'T WORK)
  • The logistic model with a maternal age explanatory variable (WORKS SUCCESSFULLY)


THANKS



CODING FOR MODEL WITHOUT MATERNAL AGE TERM (NULL MODEL):

PROC LOGISTIC DATA=WORK.DATA2 DESCENDING;

  MODEL dead;

  TITLE1 'QUESTION 5:  LOGIT-RISK -NULL- MODEL';

RUN;

PROC GENMOD DATA = WORK.DATA2 DESCENDING;

  MODEL dead = mage / LINK = logit DIST = binomial;

  TITLE1 'NULL Log-Risk Model for Infant Death';

  OUTPUT OUT=WORK.DATA4 P=PRED L=l95 U=u95;

RUN;

CODING FOR MODEL WITH MATERNAL AGE TERM:

PROC LOGISTIC DATA=WORK.DATA2 DESCENDING;

  MODEL dead = mage;

  TITLE1 'QUESTION 4:  LOGIT-RISK MODEL';

RUN;

PROC GENMOD DATA = WORK.DATA2 DESCENDING;

  MODEL dead = mage / LINK = logit DIST = binomial;

  ESTIMATE 'Risk for Maternal Age: 20' int 1 mage 20;

  ESTIMATE 'Risk for Maternal Age: 35' int 1 mage 35;

  ESTIMATE 'OR FOR 1 YEAR INCREASE' mage 1;

  ESTIMATE 'OR FOR 10 YEAR INCREASE' mage 10;

  TITLE1 'Log-Risk Model for Maternal Age (in Years) at Time of Birth';

  OUTPUT OUT=WORK.DATA3 P=PRED L=l95 U=u95;

RUN;

PROC SORT DATA=WORK.DATA3;

  BY mage;

RUN;

  goptions reset=all rotate=landscape ftitle=swiss ftext=swiss

    gunit=pct htitle=3      htext =2;

    symbol1 v=none i=j l=1 w=3;  

    symbol2 v=none i=j l=33 w=2; 

    axis1 label=('Maternal Age (Continuous)') w=3 order=(10 to 60 by 5);

  axis2 logbase=10 label = ( a = 90 'Log-Risk (95% CI) of Infant Death in < 1 Year ' )

  w = 3;

TITLE1 'Log-Risk Model for Maternal Age (in Years) at Time of Birth';

PROC GPLOT DATA=WORK.DATA3;

  PLOT pred*mage=1 l95*mage=2 u95*mage=2/OVERLAY FRAME VAXIS=axis2 HAXIS=axis1;

RUN;

QUIT;

Contributor
Posts: 50

Re: How do I use either PROC LOGISTIC or PROC GENMOD to create a logistic model without an explanatory variable?

Sorry didn't mean to have dead = mage in my null model.  The coding below is what I'm trying to use (that won't work properly).

Apologies for any confusion.

CODING FOR MODEL WITHOUT MATERNAL AGE TERM (NULL MODEL):

PROC LOGISTIC DATA=WORK.DATA2 DESCENDING;

  MODEL dead;

  TITLE1 'QUESTION 5:  LOGIT-RISK -NULL- MODEL';

RUN;

PROC GENMOD DATA = WORK.DATA2 DESCENDING;

  MODEL dead / LINK = logit DIST = binomial;

  TITLE1 'NULL Log-Risk Model for Infant Death';

  OUTPUT OUT=WORK.DATA4 P=PRED L=l95 U=u95;

RUN;

Grand Advisor
Posts: 17,342

Re: How do I use either PROC LOGISTIC or PROC GENMOD to create a logistic model without an explanatory variable?

proc freq instead with the binomial option.

Contributor
Posts: 50

Re: How do I use either PROC LOGISTIC or PROC GENMOD to create a logistic model without an explanatory variable?

OK I actually figured it out.  For anybody interested, it can be completed using PROC GENMOD.  I was missing the = after my outcome term (see below)

PROC GENMOD DATA = WORK.DATA2 DESCENDING;

  MODEL dead= / LINK = logit DIST = binomial;

  TITLE1 'NULL Log-Risk Model for Infant Death';

  OUTPUT OUT=WORK.DATA4 P=PRED L=l95 U=u95;

RUN;

Ask a Question
Discussion stats
  • 3 replies
  • 290 views
  • 0 likes
  • 2 in conversation