BookmarkSubscribeRSS Feed
catch18
Obsidian | Level 7

Hi,

I am trying to visualise a significant categorical interaction in proc logistics via the below code.

Health is categorized as 0 - low, 1- med, 2 -high, bsex is 0- female, 1-male.

ODS graphics on;

PROC logistic data=work;

class Primiparity (ref="yes") Health (ref="2) bsex (ref="0")/param=ref;

MODEL LGAc (event='1') = Health Primiparity bsex Health_sex/noor;

effectplot / at(bSex=all) noobs;

effectplot slicefit(sliceby=bSex plotby=Health)/ noobs;

RUN;

Would this code be right?

 

Many thanks

 

16 REPLIES 16
PaigeMiller
Diamond | Level 26

You code does not include an interaction in the MODEL statement, so I don't think it is right.

--
Paige Miller
catch18
Obsidian | Level 7
Thanks @PaigeMilller.
I had run an initial data step and included the statement: Health_sex=Health*sex for the interaction term. So Health_sex in the model is representing my interaction term.
I asked the question because when I split the dataset into male and female and run the same model separately, but excluding bsex and the interaction term, my odds ratios don't appear to be giving a similar picture as the predicted probability plots?
PaigeMiller
Diamond | Level 26

If health and sex are categorical variables, then Health*Sex is meaningless code, you can't multiply health times sex. 

 

Furthermore, even if you create the variable health_sex somehow, unless you do it properly you do not get the interaction. So let's clear this up first before we get into splitting the data sets.

--
Paige Miller
catch18
Obsidian | Level 7
Great, so what do you suggest?
PaigeMiller
Diamond | Level 26
MODEL LGAc (event='1') = Health Primiparity bsex Health*sex/noor;

In a model statement, constructs with an * do not indicate multiplication, it indicates creating an interaction (properly). 

--
Paige Miller
catch18
Obsidian | Level 7
Yes, but when I had run this initially without creating the data step. SAS told me the variable Health*sex did not exist?
Thanks.
PaigeMiller
Diamond | Level 26

Show me the log from when you try this. I want to see the code as seen in the log, plus ERRORs, WARNINGs and NOTEs for this PROC step. Do not chop anything out of the log for this PROC step.

 

Please format the log so that it is readable. You do this by copying the log as text, then pasting it into the window that appears after you click on the </> icon. DO NOT SKIP THIS STEP.

--
Paige Miller
catch18
Obsidian | Level 7
Thanks @PaigeMiller!
It appears to have run without a problem. I'm not sure why I thought I had to create the variable first.
I did run the same data with proc reg earlier on and this was the log:
1406 PROC reg data= work;*Final model;
1407 MODEL StdTotalsubcut_b_cond = StdHealth Primiparity bsex Health*bsex;
-
22
200
NOTE: The previous statement has been deleted.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_, {.
ERROR 200-322: The symbol is not recognized and will be ignored.
1408 RUN;

WARNING: No variables specified for an SSCP matrix. Execution terminating.
NOTE: PROCEDURE REG used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

PaigeMiller
Diamond | Level 26

@catch18 wrote:
Thanks @PaigeMiller!
It appears to have run without a problem. I'm not sure why I thought I had to create the variable first.

So, are we done?

--
Paige Miller
catch18
Obsidian | Level 7
So I rerun the code again with interaction term as discussed and this is the log;
NOTE: PROC LOGISTIC is modeling the probability that LGAc='1'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: Under full-rank parameterizations, Type 3 effect tests are replaced by joint tests. The
joint test for an effect is a test that all the parameters associated with that effect
are zero. Such joint tests might not be equivalent to Type 3 effect tests under GLM
parameterization.
ERROR: The specified plot type does not support the variable configuration.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 283 observations read from the data set TARGET.PATTERN_MORPH_LOG.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 1.07 seconds
cpu time 0.73 seconds



PaigeMiller
Diamond | Level 26

Hi ... I gave specific instructions on how to provide the LOG from a SAS program. Please follow those instructions.

--
Paige Miller
catch18
Obsidian | Level 7
NOTE: PROC LOGISTIC is modeling the probability that LGAc='1'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: Under full-rank parameterizations, Type 3 effect tests are replaced by joint tests. The
      joint test for an effect is a test that all the parameters associated with that effect
      are zero. Such joint tests might not be equivalent to Type 3 effect tests under GLM
      parameterization.
ERROR: The specified plot type does not support the variable configuration.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 283 observations read from the data set TARGET.PATTERN_MORPH_LOG.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           1.07 seconds
      cpu time            0.73 seconds

catch18
Obsidian | Level 7
Is this any better? Thanks
catch18
Obsidian | Level 7
1409  ODS graphics on;
1410  PROC logistic data= work;*Final model;
1411  class Primiparity(ref="Yes") Health (ref="2") bsex (ref="0")/param=ref;
1412  MODEL LGAc (event='1') = Health Primiparity bsex Health*bsex/noor;
1413  effectplot / at(bSex=all) noobs;
1414  effectplot slicefit(sliceby=bSex plotby=Health)/ noobs;
1415  RUN;

NOTE: PROC LOGISTIC is modeling the probability that LGAc='1'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: Under full-rank parameterizations, Type 3 effect tests are replaced by joint tests. The
      joint test for an effect is a test that all the parameters associated with that effect
      are zero. Such joint tests might not be equivalent to Type 3 effect tests under GLM
      parameterization.
ERROR: The specified plot type does not support the variable configuration.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 283 observations read from the data set TARGET.PATTERN_MORPH_LOG.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           1.07 seconds
      cpu time            0.73 seconds

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!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 1325 views
  • 0 likes
  • 2 in conversation