Help using Base SAS procedures

calculate chi square and risk across observations

Reply
New Contributor
Posts: 3

calculate chi square and risk across observations

Very grateful for any help with this basic question

Historical data used to research the question of whether smoking causes cancer

yields the following table.

Smoking Habit/Cancer      Cancer    No Cancer     Total

None to Slight                   56        956                1012

Moderate to Excessive      269       1646              1915

Total                                325       2602               2927

Question:

1) calculate the risk of a person who is a moderate

or excessive smoker having cancer?

2) perform a chi - square test on these data using

PROC FREQ and state your conclusions?

MY answer for 2)

data nothing;

input Smoking_Habit_Cancer $ 1-22  Cancer 23-26  No_Cancer 27-31 Total 32-36;

datalines;

None to Slight         56  956  1012

Moderate to Excessive  269 1646 1915

Total                  325 2602 2927

;

ods html;

PROC FREQ ORDER=DATA; WEIGHT cancer ;

TABLES smoking_habit_cancer*cancer /chisq ;

RUN;

ods html close;

Super User
Posts: 17,840

Re: calculate chi square and risk across observations

That looks like homework to me, but I'll tell you its wrong. Take a look at your proc freq output, the table should at least match your input table, if it doesn't you haven't done your chi-square correctly.

See the example in the docs that does pretty much what you're looking for:

Base SAS(R) 9.2 Procedures Guide: Statistical Procedures, Third Edition

Ask a Question
Discussion stats
  • 1 reply
  • 137 views
  • 0 likes
  • 2 in conversation