BookmarkSubscribeRSS Feed
klovewalk
Calcite | Level 5

I was given the following instructions: Deaths from heart disease comprise the following causes : I00-I09, I11, I13, I20-I51. How many males and females died from heart disease and what was the mean and median age at death for both genders

So I tried the following but am getting errors. Can you assist? Thanks.

PROC FREQ DATA=epi2.heartdis;

table cau*gen;

where cau in ('I00', 'I01', 'I02', 'I03',

'I04', 'I05', 'I06', 'I07', 'I08','I09') and cau ('I11')

and cau ('I13')and ('I20'<cau<'I51');

run

4 REPLIES 4
ArtC
Rhodochrosite | Level 12

Did you get your question answered? This question would have been more appropriately placed in the SAS Procedures forum.

That said the problem is in your WHERE  which probably should read:

where cau in ('I00', 'I01', 'I02', 'I03',

'I04', 'I05', 'I06', 'I07', 'I08','I09') or cau=('I11')

or cau=('I13') or('I20'<cau<'I51');

art297
Opal | Level 21

Based on your requirements I agree with Art except for the last condition, where I think it should read:

or('I20'<=cau<='I51')

However, that said, why not used the same type of coding for the other range?  If you do, your where statement would look a lot closer to your instructions, namely:

where ('I00'<=cau<='I09') or cau in ('I11','I13') or ('I20'<=cau<='I51');

(Note: I modified the above statement after reading Mike's comment and realized that I hadn't applied my own suggested code.)

MikeZdeb
Rhodochrosite | Level 12

Hi.  Another question ... what is the LENGTH of CAU, 3 or 4?  Since ICD10 cause of death codes

have four characters, it is possible thaty CAU has a length of 4.  Then Art's solution ...

where cau in ('I00', 'I01', 'I02', 'I03',

'I04', 'I05', 'I06', 'I07', 'I08','I09') or cau=('I11')

or cau=('I13') or('I20'<cau<'I51');

should be changed (I agree with "other Art" about the I20 to I59 range needing the =s) ...

where cau in : ('I00', 'I01', 'I02', 'I03', 'I04', 'I05', 'I06', 'I07', 'I08','I09') or

      cau eq : 'I11' or cau eq : 'I13' or

      'I20' <= cau <= : 'I51');

or the "other Art' ...

where ('I00'<=cau<= : 'I09') or cau in : ('I11','I13') or ('I20'<=cau<= : 'I51');



ArtC
Rhodochrosite | Level 12

Good catch Mike.  If these are indeed $4 cause of death codes then the OP must be sure to understand the usage of the : comparison modifier.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 4 replies
  • 672 views
  • 0 likes
  • 4 in conversation