Modify outmodel = dataset in Proc logistic

Reply
New Contributor
Posts: 4

Modify outmodel = dataset in Proc logistic

Hi,

In my modeling process, I created a model fitting result by using outmodel = FIT in proc logistic,

and later on use inmodel = FIT to generate prediction.

Now I want to modify this fiting result, called FIT, to add a new level of a categorical variable.

For example, in outmodel=  step, a categorical variable,  CAT has three level,

AAA, BBB and CCC, with fitted coefficient, 0, 2 and 4, respectively. Now in the inmodel =  step,

I have another level, DDD, I want to set its cofficient as 5. How do I manually add another level of category

to this variable CAT in the fit result FIT?

Fit looks like:

_TYPE__NAME__CATEGORY__NAMEIDX__CATIDX__MISC_
L0
MNYYNYNNN
GVINTAGE1985001
GVINTAGE1986011
GVINTAGE1987021
GVINTAGE1988031
GVINTAGE1989041



with many rows following.

Also, how do I locate the coefficient of a level of a categorical variable in the FIT dataset?

Thanks!

Super User
Posts: 17,828

Re: Modify outmodel = dataset in Proc logistic

Can you post a sample of your proc logistic code? Your categorical variable depends on how you coded it in the class statement.

New Contributor
Posts: 4

Re: Modify outmodel = dataset in Proc logistic

for example:

proc logistic data= XXX outmodel = FIT;

class vintage (ref="2000",param=REF);

model response = vintage + age;

run;

I am not sure if it is ok to post original formula here since the variable is self-explanatory and might be confidential.

If full function is needed for you to explain the table, I can do some camouflage.

Thank you.

Best

Super User
Posts: 17,828

Re: Modify outmodel = dataset in Proc logistic

From the documentation:

                                 OUTMODEL=SAS-data-set 

specifies the name of the SAS data set that contains the information about the fitted model. This data set contains sufficient information to score new data without having to refit the model. It is solely used as the input to the INMODEL= option in a subsequent PROC LOGISTIC call. The OUTMODEL= option is not available with the STRATA statement. Information in this data set is stored in a very compact form, so you should not modify it manually.

What version of SAS are you on? If 9.4 look at the CODE statement, that might be easier to modify to score new data.

New Contributor
Posts: 4

Re: Modify outmodel = dataset in Proc logistic

I am using 9.3.

Super User
Posts: 17,828

Re: Modify outmodel = dataset in Proc logistic

Ok you could use the ODS table parameter estimates but you would "manually" have to calculate your estimates.

Here's one way to manually create the predictions and you could modify the formula.

You should also try posting to the SAS Statistical Forum and see if someone from SAS can comment on the OUTMODEL dataset.

New Contributor
Posts: 4

Re: Modify outmodel = dataset in Proc logistic

Thank you Reeza.

Actually I tried outest or ods output before. But manually calculate estimate leaves too much possibility of human error.

It is also not convenient if I change the model or variable name.

Thanks for the link. I'll look into that.

Currently my thought is make the new level of cat variable the same as one of the current level, but add another indicator.

When SAS finishes calculating, I'll manually subtract the old level coefficients from the log odd ratio, and add the new level coefficients.

Ask a Question
Discussion stats
  • 6 replies
  • 488 views
  • 0 likes
  • 2 in conversation