Hi, without data it's not entirely clear what you want. I read this as you want the "new" B value to become the value for A, IF the first character of "old B" value is a number/digit and you want to switch the A value to the "new" B? Like this: Is this what you meant? If so, assuming the data (WORK.FAKEDATA) shown in the first PROC PRINT, this program using ANYDIGIT and SUBSTR does the swap. You can look in the doc to find out what those functions do, as well as looking up the RENAME= option. Of course, you may need to tweak the program based on the real names and lengths of your real variables. The Final dataset is called WORK.SWITCH. Cynthia data switch; set fakedata(rename=(b=oldb)); if anydigit(substr(oldb,1,1)) = 1 then do; b = a; a=oldb; end; else do; b = oldb; end; run; proc print data=switch; title 'Switched data (can drop OLDB var after verifying)'; var a b oldb; run; title;
... View more