Hi, I'm currently working on proc logistic using macro and I'm stuck somewhere...
I'd like to make OddsRatios ODS output, which should be created by default, but it seems that my code doesn't provide this output with this warning message:
"WARNING: Output 'OddsRatios' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used."
I'd like to create a table with point estimate, CI and p-value but I guess other tables that I have checked by ods trace on; don't have those things.
Anyone can help me find it out? Thank you in advance.
Here's my code:
%macro mlogitadj(table, var, ref, class, varcat, varcont, mod); proc logistic data=&table; format (formatting for variables) ; class &class; model &var (ref=&ref)= &varcat &varcont/ lackfit link=glogit; ods output OddsRatios = or_&mod NObs = NObs&mod ModelANOVA = T3_&mod; run;
And the ods trace provides these tables available:
ModelInfo, NObs, ResponseProfile, ClassLevelInfo, ConvergenceStatus, FitStatistics, GlobalTests, ModelANOVA, ParameterEstimates, LackFitPartition, Stat.Logistic.LackFitChiSq and LackFitChiSq
First, if you are using CLASS variables they should appear on the MODEL statement if you expect any output involving those variables.
I would suggest for one of these models to do the model without any of the macro coding for the model that did not create output , run that model and provide the entire log for that run if it still does not produce the ODDSRATIO output.
Oddsratio output should be produced by Proc Logistic with a valid model statement unless there is something odd with the data but we would need to see the LOG for the step to see if you are getting any of the likely messages related to problem data. Copy the Log for the non-macro version (or run the macro with OPTIONS MPRINT; set) including all the code and messages generated, on the forum open a text box and paste the entire log text.
Thank you for your answer.
Here's the log message with non-macro code.
4362 proc logistic data=totaldata (where=(traj_presence2=1)); 4363 class (vars); 4365 model group (ref='3')= (vars) lackfit link=glogit; 4366 ods output OddsRatios = or_inter1 4367 NObs = NObsinter1 4368 ModelANOVA = T3_inter1; 4369 run; NOTE: PROC LOGISTIC is fitting the generalized logit model. The logits modeled contrast each response category against the reference category (GROUP=3). 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. NOTE: The data set WORK.T3_INTER1 has 3 observations and 4 variables. NOTE: Compressing data set WORK.T3_INTER1 increased size by 100.00 percent. Compressed is 2 pages; un-compressed would require 1 pages. NOTE: The data set WORK.NOBSINTER1 has 2 observations and 6 variables. NOTE: Compressing data set WORK.NOBSINTER1 increased size by 100.00 percent. Compressed is 2 pages; un-compressed would require 1 pages. WARNING: Output 'OddsRatios' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. NOTE: There were 9273 observations read from the data set WORK.TOTALDATA. WHERE traj_presence2=1; NOTE: The PROCEDURE LOGISTIC printed pages 1-3. NOTE: PROCEDURE LOGISTIC a utilisé (Durée totale du traitement) : real time 1.13 seconds cpu time 0.08 seconds
I added one interaction term (A*B) in the MODEL statement, which is not in CLASS statement. I don't think it's a problem tho.
Try duplicating this simple program, you should have the SASHELP.Class data set:
303 proc logistic data=sashelp.class; 304 class sex; 305 model age = sex; 306 ods output OddsRatios = or_inter1; 307 run; NOTE: PROC LOGISTIC is fitting the cumulative logit model. The probabilities modeled are summed over the responses having the lower Ordered Values in the Response Profile table. Use the response variable option DESCENDING if you want to reverse the assignment of Ordered Values to the response levels. NOTE: Convergence criterion (GCONV=1E-8) satisfied. NOTE: The data set WORK.OR_INTER1 has 1 observations and 4 variables. NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: PROCEDURE LOGISTIC used (Total process time): real time 0.03 seconds cpu time 0.01 seconds
If the data set Or_inter1 already exists it may not be replaced.
If this runs and creates the output data set then there is something in your data, possibly only one level of the Class variable.
Which version and what SAS environment are you running?
When I ran code with: Class (sex); I had an error message. Perhaps you should make sure that there are no parentheses around the class variable.
Hi,
When I tried without the interaction (A*B) it worked so it seems to be the oddsratios output is not produced when I put interaction in the proc logistic, and I still don't understand why 😕
Anyway thank you for your answers so far!
All the best,
what if you try using the OddsRatio statement?
title 'capsule = dig_rec_exam';
proc logistic data=ch1.prostate;
class dig_rec_exam(param=ref ref="no nodule");
model capsule (event="1") = dig_rec_exam/clodds=pl;
oddsratio 'Comparison of Digital Rectal Exam' dig_rec_exam/cl=pl;
run;
Hello,
I tried but not worked... I don't know but maybe it's because I'm currently using several independent variables with interaction term.
But thanks 😉
I think you may also be able to use proc genmod for this. I'm not an expert with either.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: