BookmarkSubscribeRSS Feed
tarheel13
Rhodochrosite | Level 12

Hi, can anyone tell me the SAS code that I would need to make a table like this? I assume that proc logistic was used. I don't need the proc report part as I know how to do that but an example of getting the odds ratios out of proc logistic would be helpful with the stratification variableScreen Shot 2021-07-16 at 6.53.35 PM.png

10 REPLIES 10
sbxkoenk
SAS Super FREQ

Hello,

 

With stratification variable, I guess you mean CLASS effect.

 

The Odds Ratios are available in standard output of PROC LOGISTIC, so you just capture the output object in a data set using ODS OUTPUT, like here:

ods trace off;
ods output OddsRatios = work.OddsRatios;
proc logistic data=sashelp.class;
 class age;
 id name;
 model sex = age weight height;
run;
/* end of program */

Note PROC LOGISTIC has an 
"ODDSRATIO Statement"

which produces odds ratios for variable even when the variable is involved in interactions with other covariates, and for classification variables that use any parameterization. You can also build Customized Odds Ratios.

 

Kind regards,

Koen

tarheel13
Rhodochrosite | Level 12

By stratification, I meant like Any UI and UUI in the picture. There would likely be a variable in the dataset that would stratify the columns for the report.

PaigeMiller
Diamond | Level 26

I guess its not clear what you mean. Show us a small portion of a data set to illustrate what you mean by "stratify the columns". (Or do you really mean "stratify the observations", such as separate odds ratios for males and females in the example by @sbxkoenk?)

--
Paige Miller
tarheel13
Rhodochrosite | Level 12

Do you see how it is split into Any UUI and UUI only? I am asking how to create the table in the picture. The dataset from what @sbxkoenk posted only has effect, oddsratioest, and lowerCL and upperCL. I need multiple columns of odds ratios like the picture, not just one column. How do you get that? 

PaigeMiller
Diamond | Level 26

Are "Any UUI" and "UUI Only" separate columns in the data set, or are they different values of one variable? Again, this all becomes clear if you show us a small portion of the data set.

--
Paige Miller
tarheel13
Rhodochrosite | Level 12

Hi @PaigeMiller . I've never made a table like this before. That's why I'm asking here because I want to learn how. Can you please tell me how this could be achieved assuming that it's values of the same variable? Just assume stratvar=1 means Any UUI and stratvar=2 means UUI only. Would I have to do proc logistic twice with where stratvar=1 and a second time with stratvar=2 or can it be done all one proc logistic? 

PaigeMiller
Diamond | Level 26

The code from @sbxkoenk shows exactly how to get these odds ratios. If you have two values of STRATVAR, you could use BY STRATVAR; in your PROC LOGISTIC.

--
Paige Miller
FreelanceReinh
Jade | Level 19

Hi @tarheel13,

 

Googling a bit, I assume that "UI" and "UUI" stand for "(urge) urinary incontinence." So, these should be the dependent (dichotomous) variables in the logistic regression(s) and column "Parameter" of the table contains demographic characteristics and pre-existing health conditions whose impact on the probability of developing UI or UUI is to be examined (i.e., predictors on the right hand side of the model equation) -- with one exception: the "Model C index" in the last row sounds more like the c statistic (=area under the ROC curve) shown in section "Association of Predicted Probabilities and Observed Responses" at the bottom of the PROC LOGISTIC output. Without this row in the table I would have thought that each predictor -- Age (continuous; in years?), Race/Ethnicity (categorical with five categories), ..., Prostate cancer (dichotomous, yes vs. no) -- would be used in a univariable logistic regression, actually two logistic regressions: one with UI (yes/no) and one with UUI (yes/no) as the dependent variable. Each of these would yield an odds ratio (or k-1 odds ratios in the case of categorical predictors with k categories). But the single c statistic suggests that (also?) multivariable logistic regressions were performed. With all of the above factors in the models? Or only those whose odds ratios were printed in bold face? Or some other subset? We can't tell from the table. Either way, these multivariable logistic regressions would likewise produce odds ratios for each of the predictors in the model, in this case adjusted for the remaining predictors in the model.

 

The first step in preparing such a table would be to create an analysis dataset for PROC LOGISTIC with the variables needed, in particular the dichotomous variables representing UI and UUI, respectively, if they don't already exist. Technically, this could also be a single variable, coded like 0=no UI, 1=any UI [edit:] except UUI, and 2=UUI, requiring more effort to tell PROC LOGISTIC what the target category is, but personally I would prefer two separate 0-1 variables. Some of the predictor variables might need some preparation as well (e.g., categorization of BMI into "obese", "overweight" and "normal weight").

tarheel13
Rhodochrosite | Level 12

@FreelanceReinh I took it from a paper. 

 

The dependent variables were the UI
subgroups (e.g., no incontinence vs. UUI) and an overall logistic
regression with ‘‘any incontinence’’ as the dependent variable
(yes to any of the UI symptoms in Table I). Each model controlled
for age, racial/ethnic group, education level, country, smoking
status (yes/no), sedentary behavior (mostly sitting during the
day), history of bed wetting, and comorbid conditions: including
arthritis, asthma, depression, diabetes, heart disease, hyperten-
sion, IBS, neurologic condition, history of recurrent UTIs, and
sleep apnea. Additional risk factors included prostate cancer and
prostatitis for men and uterine prolapse, and endometriosis
for women. Given the multiple analyses and large sample size,
P < 0.01 was considered to be significant.
 
It looks like separate models were made. I was researching this because I have an interview with one of the authors of this paper but it's just a SAS programmer position. But clearly this company makes publications that used logistic regression.
FreelanceReinh
Jade | Level 19

@tarheel13 wrote:
The dependent variables were the UI
subgroups (e.g., no incontinence vs. UUI) and an overall logistic
regression with ‘‘any incontinence’’ as the dependent variable
(yes to any of the UI symptoms in Table I).

This makes sense. So, the first model excluded the subgroup "non-urge" UI in order to focus on UUI cases. And the models seem to include almost all predictors listed in the table, suggesting that the odds ratios were taken from the multivariable analyses.

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!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 2214 views
  • 1 like
  • 4 in conversation