Hi all. Say I have a data set with these variables.
ID varA varB varAtext footnote2
1 12 34 12 * means caution in interpreting
I want to add a "*" to varAtext, so it will look like this:
ID varA varB varAtext footnote2
1 12 34 12* * means caution in interpreting
How do I do that?
In the original data set, there was another column, "Interpret_with_caution" and some rows had "YES", so I had code
if Intepret_With_Caution eq "YES" then Footnotes2 = "* means caution in interpreting";
And please, folks, no comments about why do I want to do this, why do I want to use this symbol, why do I use those words about caution, what are the rules for when to interpret with caution, and so on. Please, if you could just give me advise on how to do this, that would be great.
Thanks
The way you have worded this all you need to do is:
data want;
set have;
varAtext = cats(varAtext,'*');
run;
But I suspect there is something more complex you want to do but have not explained.
So perhaps VARATEXT is not defined long enough to handle the extra character?
Or perhaps there is some condition you need to test before adding the asterisk?
Or perhaps you want to create VARATEXT from VARA?
The way you have worded this all you need to do is:
data want;
set have;
varAtext = cats(varAtext,'*');
run;
But I suspect there is something more complex you want to do but have not explained.
So perhaps VARATEXT is not defined long enough to handle the extra character?
Or perhaps there is some condition you need to test before adding the asterisk?
Or perhaps you want to create VARATEXT from VARA?
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 25. Read more here about why you should contribute and what is in it for you!
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.