BookmarkSubscribeRSS Feed
iressa131
Calcite | Level 5

Hello:)

 

So i have the two variables AGE (41-65) and SMOKE. I am trying to see if there is an association between smoking and patients aged 65 and over vs. all others. Theres only one patient aged 65 and none over. Do i have to first create a new variable and then do the chi square test?

 

This is what I'm thinking let me know if I should be doing something else please thanks!

DATA work.HW2 ;
set  work.HW2;
INPUT person sap AGE SMK group gender wt ht chol ; 
if AGE = 65 then AGESMK = 65over ;
if AGE < 65 then AGESMK = others;
run;

DATA work.HW2;
proc freq;
title8 'Part H: Smoking and 65 and Over vs. All Others Association ';
WEIGHT AGESMK;
TABLES 65over* others/CHISQ;
RUN;
3 REPLIES 3
iressa131
Calcite | Level 5

HelloSmiley Happy

 

So i have the two variables AGE (41-65) and SMOKE. I am trying to see if there is an association between smoking and patients aged 65 and over vs. all others. Theres only one patient aged 65 and none over. Do i have to first create a new variable and then do the chi square test?

 

This is what I'm thinking let me know if I should be doing something else please thanks!

DATA work.HW2 ;
set  work.HW2;
INPUT person sap AGE SMK group gender wt ht chol ; 
if AGE = 65 then AGESMK = 65over ;
if AGE < 65 then AGESMK = others;
run;

DATA work.HW2;
proc freq;
title8 'Part H: Smoking and 65 and Over vs. All Others Association ';
WEIGHT AGESMK;
TABLES 65over* others/CHISQ;
RUN;
ballardw
Super User

You will get a warning that 25 percent of your cells had a count of less than 5 and that Chi-square may not be the appropriate test.

 

Without data more data in your 'over 65' group I don't think you'll find much luck. You might see if another age group such as 60+ tells you anything.

 

Or if the requirement is 65 and older report insufficient data in that age group. Then go back to the sample or study design and find out why...

 

You data step looks odd at worst and possibly unworkable. You have an Input statement which does not have a value for 65over (which is an invalid variable name) or  others. So you would get errors and missing values assigned to AGESMK.

 

I would expect that you either create a generic age group variable such as

 

agegroup = (age ge 65);

 

And use freq similar to:

proc freq;
title8 'Part H: Smoking and 65 and Over vs. All Others Association ';
TABLES agegroup*smk/CHISQ;
RUN;

With this case you really need to provide actual data as what you have posted is kind of hard to determine actual behavior of your data.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 794 views
  • 2 likes
  • 3 in conversation