Programming the statistical procedures from SAS

Graphing Effects Plots in Proc Genmod

Reply
Contributor
Posts: 26

Graphing Effects Plots in Proc Genmod

Hi,

Is there an equivalent of the following code {specifically the line in bold} (in ProcLogistic plots= effect statement works but in proc genmod it doesn't however the documentation says its a shared statement fro both procedure) for Proc Genmod?

/*Effects Plot*/

ods listing SGE=on;

ods trace on;

ods graphics on;

ods rtf  style=journal;

proc logistic data=xyz;

plots(only)=effect (x= x3 at (x1=6 x2= 20 )) ;

CLASS gender age_group  / param = ref ;

MODEL y(EVENT ='1')= gender age_group x1 x2 x3

x1*x2 x2*x3 x1*x3/ scale=none;

ods rtf close;

ods graphics off;

ods trace off;

Looking forward for help.

Best Regards,

Tasneem

Super Contributor
Posts: 543

Re: Graphing Effects Plots in Proc Genmod

Hi.

In your code, you need to remove the semicolon ';' before the plots statement;

proc logistic data=xyz  plots(only)=effect (x= x3 at (x1=6 x2= 20 )) ;

Try and let us know.


Anca.

Contributor
Posts: 26

Re: Graphing Effects Plots in Proc Genmod

Hi Anca,

Thanks for your response. I tried what you suggested but it gives the following error:

PROC GENMOD DATA=a

plots(only)=effect (at (centred_AQ=6.33 centred_AC= 21 )) ;

              

ERROR 22-322: Syntax error, expecting one of the following: (, ALL, CLEVERAGE, CLUSTERCOOKSD,

              CLUSTERDFIT, COOKSD, DCLS, DFBETA, DFBETAC, DFBETACS, DFBETAS, DOBS, LEVERAGE, MCLS,

              NONE, PREDICTED, RESCHI, RESDEV, RESLIK, RESRAW, STDRESCHI, STDRESDEV.

ERROR 76-322: Syntax error, statement will be ignored.

Can you please suggest anything else?

Thanks

Tasneem

Super Contributor
Posts: 543

Re: Graphing Effects Plots in Proc Genmod

Would you remove the 'only" from the plots statement;

OR

add plots(only label) = ...

Contributor
Posts: 26

Re: Graphing Effects Plots in Proc Genmod

If I remove only from plots statement, I get the following error:

plots=effect (at (centred_AQ=6.33 centred_AC= 21 )) ;

         

ERROR 22-322: Syntax error, expecting one of the following: (, ALL, CLEVERAGE, CLUSTERCOOKSD,

              CLUSTERDFIT, COOKSD, DCLS, DFBETA, DFBETAC, DFBETACS, DFBETAS, DOBS, LEVERAGE, MCLS,

              NONE, PREDICTED, RESCHI, RESDEV, RESLIK, RESRAW, STDRESCHI, STDRESDEV.

ERROR 76-322: Syntax error, statement will be ignored.

Also, if I use "predicted" option I still get an error..

plots=predicted (at (centred_AQ=6.33 centred_AC= 21 )) ;

                    

ERROR 79-322: Expecting a CLM.

ERROR 76-322: Syntax error, statement will be ignored.

I would appreciate any suggestions or comments.

Thanks

Tasneem

Super Contributor
Posts: 543

Re: Graphing Effects Plots in Proc Genmod

When I ran this code, it works...using my own data

ods listing SGE=on;

ods trace on;

ods graphics on;

ods rtf  style=journal;

proc logistic data=my_data plots=effect (x= bmi at (age=50 dm= '1' )) ;

CLASS gender(ref = first) cs_dm(ref= first)/ param = ref ;

MODEL cs_htn = gender bmi age cs/scale = none;

run;

ods rtf close;

ods graphics off;

ods trace off;

Super Contributor
Posts: 543

Re: Graphing Effects Plots in Proc Genmod

the difference between my code and yours is that in the plots statement I have

plots= effect(x = my_var at (....))

and you have plots = effect(at (....));

...

and my code still worked after I removed x= my_var

So, not sure what the issue is

Smiley Sad

Contributor
Posts: 26

Re: Graphing Effects Plots in Proc Genmod

Hi Anca,

Thanks a lot for looking into my problem, I really appreciate your help.

I am using Proc Genmod , have you used  effects plot option for PROC Genmod?

My code also works for proc logistic but the issue is with proc genmod

I am copying my entire code and I would really appreciate if you can have a look at it at your conveninece. I am really baffled as to why the same code works for PROC logistic but not PROC

PROC GENMOD DATA=xyz plots= effect(x=centred_SE at(centred_AQ=6.33 centred_AC= 21));

class gender grage gr_revenu2 SM02 cardiac_related_condition PHYSICIAN NAM PATIENT;

MODEL FOLLOWUP_T1_12M_OOC = gender grage gr_revenu2 SM02 cardiac_related_condition

centred_SE centred_AQ centred_AC  centred_SE*centred_AC ;

Repeated subject=PATIENT(PHYSICIAN) / corr=exch corrw;

run;

Looking forward to your comments and suggestions.

Thanks

Tasneem

Message was edited by: Tasneem Zaihra

Super Contributor
Posts: 543

Re: Graphing Effects Plots in Proc Genmod

Hi Tasneem.

I realized that I've been using PROC LOGISTIC and not GENMOD, and after further reading, the GENMOD's syntax is different thatn that of LOGISTIC's.

So, you can't have ....plots = effect( x at (y = ... z = ...))

Instead you could use  plots = all, in your GENMOD statement.

Of course that may not be what you want....

So, maybe someone more experienced can tell you how to replicate the PROC LOGISTIC plots = effect....in GENMOD.

Best of luck,

Anca.

Ask a Question
Discussion stats
  • 8 replies
  • 291 views
  • 3 likes
  • 2 in conversation