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.
If I am understanding you properly
newvariable = missing(last_name);
If I am understanding you properly
newvariable = missing(last_name);
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.