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

I am trying to convert all last names of a patient to the number 0. Writing out each last name is not realistic as I have over 2 million last names. Is there a way to do this? I am trying to recode names present to 0 and missing to 1. 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If I am understanding you properly

 

newvariable = missing(last_name);
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

If I am understanding you properly

 

newvariable = missing(last_name);
--
Paige Miller
ballardw
Super User

If you want to do something like missing nonmissing you do not need to convert anything.

In a data step

 

MissingName = missing(yournamevariable);

 

will create a new variable named MissingName and if the variable is missing, i.e. blank, then will be assigned the value of 1 and 0 otherwise. Missing is one of the functions that works with both character and numeric variables.

 

If you want to overwrite the value in the name then you convert the result to text using the PUt function

 

name = put(missing(name),1. );

The format 1. means just use one character for the result so  the value will be in the first column of the name variable.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 344 views
  • 3 likes
  • 3 in conversation