@Kadz_sas1990 wrote: it worked in the previous code if type='num' then put ' ' name '=9999;'; else if type='char' then do; put @3 name '= cats("TEST", _n_) ;'; end; if last.memname then put 'run;' ; run; GOT output like 'T' in masked column instead of 'TEST_n_' if the column length is 1
If your source column has a length of 1 then you can't store more than one character in it. That's why you get the truncation warning and only the first character T as a result.
Attached the last cut of all the code versions I've posted for you. That works totally fine also for character variables with a length of 1. It will store Z in it.
The code bit with cats("TEST", _n_) was for the special treatment of variables where you've asked for a different string with a counter. This will of course only work for character variables with a sufficient string length.
Please try to understand the code I've provided to you before you change it. This code was always meant as a template for you and it was also meant as a quick solution for some adhoc-level data masking exactly the way you've asked for. If you/your company need professional level ongoing data masking then you need to look into the SAS Federation Server or data masking options provided by databases.
I'm now done with this thread and won't answer further questions.
... View more