Programming the statistical procedures from SAS

How to adjust for age in given example?

Occasional Contributor
Posts: 7

How to adjust for age in given example?

Dear all,

I am currently having some problems with a minor issue. If anyone could please help me I would be very grateful. I hope I have explained my self in an understandable way, otherwise please let me know.

I have calculated Odds ratios using the proc freq procedure for chisq measures. These however are the crude numbers and I need to adjust for age. And I am not sure which statistical measure will be the best suited to do so.

I am doing a cross sectional study using register based materials. I am comparing to groups and these groups differ significantly age wise.

I have found the following code in SAS examples, were they use Cochran-Mantel-Haenszel statistics to adjust for gender:

(copy/paste from Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, Third Edition )

Data Migraine;

Input Gender $ Treatment $ Response $ Count @@;


female Active  Better 16   female Active  Same 11

female Placebo Better 5   female Placebo Same 20

male Active  Better 12   male   Active  Same 16

male   Placebo Better  7   male   Placebo Same 19

The following PROC FREQ statements create a multiway table stratified by Gender, where Treatment forms the rows and Response forms the columns. The CMH option produces the Cochran-Mantel-Haenszel statistics. For this stratified table, estimates of the common relative risk and the Breslow-Day test for homogeneity of the odds ratios are also displayed. The NOPRINT option suppresses the display of the contingency tables. These statements produce Output 3.7.1 through Output 3.7.3.

proc freq data=Migraine;

tables Gender*Treatment*Response / cmh;

weight Count;

title 'Clinical Trial for Treatment of Migraine Headaches';


My question is how to adjust for age and not gender using the Cochran-Mantel-Haenszel statistics. Do I need to split up the data into age groups 25-35 years, 35-45 years, 45-55 years and so on? My data set is currently not divided into groups but range for 16 years to 100 years +

Respected Advisor
Posts: 2,655

Re: How to adjust for age in given example?

Your approach is correct.  After creating the age groups, use PROC FREQ in a manner similar to the given example, replacing Gender with whatever variable name you use to create the age groups.

You may wish to examine if your age data divides itself naturally, rather than forcing 10 year strata.

Good luck.

Steve Denham

Occasional Contributor
Posts: 7

Re: How to adjust for age in given example?

Thank you very much Steve - that was very help full.  I have had success implementing the codeSmiley Happy

I just have a quick question to the results. I get the following output:

Summary Statistics for druk by AMI

  Controlling for aldvintr

Cochran-Mantel-Haenszel Statistics (Based on Table Scores)

Statistic Alternative Hypothesis    DF Value      Prob


1 Nonzero Correlation               1 14.2628    0.0002

2 Row Mean Scores Differ            1 14.2628 0.0002

3 General Association               1 14.2628    0.0002

Estimates of the Common Relative Risk (Row1/Row2)

Type of Study   Method               Value     95% Confidence Limits


Case-Control Mantel-Haenszel        0.5349       0.3856 0.7419

(Odds Ratio)    Logit **            0.7646       0.5653 1.0340

Cohort Mantel-Haenszel             0.9331        0.9063 0.9608

(Col1 Risk) Logit                  0.9176        0.9030 0.9324

Cohort Mantel-Haenszel             1.7213        1.2843 2.3070

(Col2 Risk)     Logit **           1.1898        0.9218 1.5358

** These logit estimators use a correction of 0.5 in every cell

of those tables that contain a zero. Tables with a zero

row or a zero column are not included in computing the

logit estimators.

Breslow-Day Test for

Homogeneity of the Odds Ratios


Chi-Square 36.3092

DF 52

Pr > ChiSq 0.9516

Total Sample Size = 4509

My question is to the interpretation of the above. Are the yellow high-lighted numbers the result I am looking for? So that the adjusted OR in the above given example equals OR: 0.5349; 95%CI: 0.3856; 0.7419, p value =0.002

Respected Advisor
Posts: 2,655

Re: How to adjust for age in given example?

Yes--the age adjusted OR is 0.5349 with a 95% confidence interval of (0.3856, 0.7419).  The p value is for the null hypothesis of OR=1.

Steve Denham

Occasional Contributor
Posts: 7

Re: How to adjust for age in given example?

Allright that sounds great. Once again thank you very much for your help Steve - it has been highly appreciated from a statistical newbieSmiley Wink

Grand Advisor
Posts: 9,463

Re: How to adjust for age in given example?

Put AGE at the first position. as Steve pointed .

tables AGE*Treatment*Response / cmh;

Occasional Contributor
Posts: 7

Re: How to adjust for age in given example?

Also a great thanks to you XiaSmiley Happy

Ask a Question
Discussion stats
  • 6 replies
  • 3 in conversation