Hi,
I'm having difficulty outputting the C.I.'s and odds ratios into a data set, could someone give me advice on how to do that?
proc genmod data=have descending;
by visit;
class trt loc;
model outcome = trt age loc;
lsmeans trt/ diff cl ilink oddsratio;
run;
The general method of finding the table name for ODS OUTPUT, that works for any PROC, not just GENMOD, is to run the code with ODS TRACE ON;
ods trace on;
proc glm data=sashelp.class;
class sex;
model height=age weight sex/solution;
run; quit;
ods trace off;
You will see this in the log, and so the table name of each part of the output can be found in this log output next to "Name:"
Output Added:
-------------
Name: ClassLevels
Label: Class Levels
Template: STAT.GLM.ClassLevels
Path: GLM.Data.ClassLevels
-------------
Output Added:
-------------
Name: NObs
Label: Number of Observations
Template: STAT.GLM.NObsNotitle
Path: GLM.Data.NObs
-------------
Output Added:
-------------
Name: OverallANOVA
Label: Overall ANOVA
Template: stat.GLM.OverallANOVA
Path: GLM.ANOVA.Height.OverallANOVA
-------------
Output Added:
-------------
Name: FitStatistics
Label: Fit Statistics
Template: stat.GLM.FitStatistics
Path: GLM.ANOVA.Height.FitStatistics
-------------
Output Added:
-------------
Name: ModelANOVA
Label: Type I Model ANOVA
Template: stat.GLM.Tests
Path: GLM.ANOVA.Height.ModelANOVA
-------------
Output Added:
-------------
Name: ModelANOVA
Label: Type III Model ANOVA
Template: stat.GLM.Tests
Path: GLM.ANOVA.Height.ModelANOVA
-------------
Output Added:
-------------
Name: ParameterEstimates
Label: Solution
Template: stat.GLM.Estimates
Path: GLM.ANOVA.Height.ParameterEstimates
-------------
In this case, you could obtain the parameter estimates by using table name ParameterEstimates
ods output parameterestimates=parms;
Alternative method:
For specific PROCs, like GENMOD, you can go into the SAS documentation for that PROC, and click on Details, then select ODS Table Names to see a list of what table names are available, and you can then select the one you want.
The general method of finding the table name for ODS OUTPUT, that works for any PROC, not just GENMOD, is to run the code with ODS TRACE ON;
ods trace on;
proc glm data=sashelp.class;
class sex;
model height=age weight sex/solution;
run; quit;
ods trace off;
You will see this in the log, and so the table name of each part of the output can be found in this log output next to "Name:"
Output Added:
-------------
Name: ClassLevels
Label: Class Levels
Template: STAT.GLM.ClassLevels
Path: GLM.Data.ClassLevels
-------------
Output Added:
-------------
Name: NObs
Label: Number of Observations
Template: STAT.GLM.NObsNotitle
Path: GLM.Data.NObs
-------------
Output Added:
-------------
Name: OverallANOVA
Label: Overall ANOVA
Template: stat.GLM.OverallANOVA
Path: GLM.ANOVA.Height.OverallANOVA
-------------
Output Added:
-------------
Name: FitStatistics
Label: Fit Statistics
Template: stat.GLM.FitStatistics
Path: GLM.ANOVA.Height.FitStatistics
-------------
Output Added:
-------------
Name: ModelANOVA
Label: Type I Model ANOVA
Template: stat.GLM.Tests
Path: GLM.ANOVA.Height.ModelANOVA
-------------
Output Added:
-------------
Name: ModelANOVA
Label: Type III Model ANOVA
Template: stat.GLM.Tests
Path: GLM.ANOVA.Height.ModelANOVA
-------------
Output Added:
-------------
Name: ParameterEstimates
Label: Solution
Template: stat.GLM.Estimates
Path: GLM.ANOVA.Height.ParameterEstimates
-------------
In this case, you could obtain the parameter estimates by using table name ParameterEstimates
ods output parameterestimates=parms;
Alternative method:
For specific PROCs, like GENMOD, you can go into the SAS documentation for that PROC, and click on Details, then select ODS Table Names to see a list of what table names are available, and you can then select the one you want.
@Hello_there wrote:
Thanks for showing me this, i tried to look at the documentation to see if there was a way to output the exponentiated odds ratios, but i didn't see anything. I assume there's no way to directly output the OR's and the C.I.'s, so i have to just exponentiate them in a separate data step.
Is this a new question? You didn't mention exponentiated odds ratio initially. Yes, the methods I provided above will allow you to get output of Odds Ratios into a SAS data set. Whatever output you want can be directed to a SAS data set.
@Hello_there wrote:
Haha, technically yes it's a new question. But since it's related to the premise of the topic, i guess i needed confirmation to see that in order to obtain the OR's and C.I.'s i'd have to exponentiate the parameter estimates.
I don't think you have to do that. The ILINK option ought to do that for you.
@Hello_there wrote:
It shows the OR's in the output window, but i have to manually exponentiate them in the data set in order to get them into a table.
Let's work on one question at a time. Let's just forget exponentiated odds ratios for now. Did you try any of the methods I suggested to get the odds ratio into a SAS data set?
Now that I think about it, exponentiated odds ratios seems like it is something that doesn't exist, and that's why you don't see them; exponentiated LSMEANS is what the ILINK option is producing.
Please show me the LSMEANS output. Please show me the ODS TRACE OUTPUT. Please show me the SAS data set created by ODS OUTPUT of the LSMEANS output.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.