BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Beanpot
Fluorite | Level 6

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
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.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
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.

--
Paige Miller
Beanpot
Fluorite | Level 6

Ah ha. Thanks! As usual the simple answer is the correct answer.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 766 views
  • 0 likes
  • 2 in conversation