I am trying to duplicate a string column.
in a data step, I am using
oldvar=newvar
but in the output table the newvar comes back as "."
Is there a special option to duplicate the characters in a string variable?
I am on SAS EG 7.13
No, there is no extra step required. My guess is 'newvar' isn't actually new but is somehow defined in the dataset already as a numeric field. Ensure that the variable name is new or make sure the types match up when re-assigning data.
No, there is no extra step required. My guess is 'newvar' isn't actually new but is somehow defined in the dataset already as a numeric field. Ensure that the variable name is new or make sure the types match up when re-assigning data.
To assign the value to the newvar you need to reverse the order:
newvar = oldvar;
The way you are doing it, using a variable that didn't exist before on the RIGHT side of = means that SAS created one to reference and since there wasn't any definition then the default is a numeric. And then without assigning a value it is initialized as missing.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.