Help using Base SAS procedures

help needed

Reply
Occasional Contributor
Posts: 6

help needed

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

Valued Guide
Posts: 632

help needed

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');

PROC Star
Posts: 7,360

Re: help needed

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.)

Valued Guide
Posts: 765

Re: help needed

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');



Valued Guide
Posts: 632

Re: help needed

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.

Ask a Question
Discussion stats
  • 4 replies
  • 127 views
  • 0 likes
  • 4 in conversation