Hi, I'm working on a project using US Mortality Multiple Cause Files (https://www.cdc.gov/nchs/data_access/vitalstatsonline.htm#Tools) to look at specific causes of death. When I import the data it seems to work correctly. For example, when I check the frequency of the ICD codes they all show up. However, when I try to check a specific value within the ICD variable I get an error saying the variable is not in the dataset. How can I correct this? Thanks in advance, examples below.
Data step code/import:
Beanpot_0-1675956787012.png
Check ICD variable:
Beanpot_1-1675956831417.png
Check output:
Beanpot_2-1675956859916.png
Check specific value:
Beanpot_3-1675956911647.png
Beanpot_4-1675956940309.png
where ICD='A009';
When you want to refer to a value of a character variable, the value must be in (single or double) quotes. Otherwise, SAS thinks A009 is the name of a variable.
where ICD='A009';
When you want to refer to a value of a character variable, the value must be in (single or double) quotes. Otherwise, SAS thinks A009 is the name of a variable.
Ah ha. Thanks! As usual the simple answer is the correct answer.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.