I have an ID variable that I want to be able to reverse for privacy. Say I have a list of ID's like 1234, is there an easy way to make that observation 4321?
The reverse() function ...
https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245941.htm
If your variable is numeric convert it to character first using PUT(var, 8.)
If you would like something a bit more obscure and not subject to the issues of one id= 123 and another 321 in your data try the various bitwise logical functions if your ID is numeric.
For example look at
data _null_;
do x= 10 to 1010 by 10 ;
y = bnot(x);
z = bnot(y);
put y= z= ;
end;
run;
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.