01-22-2015 12:00 PM
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:
with many rows following.
Also, how do I locate the coefficient of a level of a categorical variable in the FIT dataset?
01-22-2015 08:44 PM
proc logistic data= XXX outmodel = FIT;
class vintage (ref="2000",param=REF);
model response = vintage + age;
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.
01-22-2015 11:28 PM
From the documentation:
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.
01-24-2015 01:45 PM
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.
01-24-2015 01:52 PM
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.