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

In SAS, there is the ability to speficiy that if a variable is within a range of numbers, that you can recode them i.e. if variable in (1 2 3 4 5) then new_variable = 1;

I am wondering if the same can be done with a character variable. I am analyzing data with ICD9 codes and not all the codes are numeric. I am specifically wanting to have a series of ICD9 codes from V277 to V277.2.

Is there a way in SAS to write that I want to identify records that contain an ICD9 code between V277 and V277.2

thank you for any help you can provide.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

if "V277" le yourcodevariable le "V277.2"  MAY work. It may not if there are codes such as V277.12 that you do not want.

View solution in original post

1 REPLY 1
ballardw
Super User

if "V277" le yourcodevariable le "V277.2"  MAY work. It may not if there are codes such as V277.12 that you do not want.

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!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 725 views
  • 0 likes
  • 2 in conversation