libname cert 'C:\practice everyday\input';
libname results 'C:\practice everyday';
data results.output09;
set cert.input09;
a = substr(custID,3,4);
b = a*1000;
custID = tranwrd(custID,a,'9999');
run;
proc print data = results.output09;
run;
when I use variable a instead of 'substr(custID,3,4) as the second argument of the function tranwrd, it doesn't work. why?
The following is the data :
libname cert 'c:\cert\input';
Data cert.input09;
Input custID $;
Datalines;
ID1573
ID2369
ID5361
ID8902
;
Run;
Try defining the A variable first with the proper type and length. You are replacing a character string, length of 4.
data results.output09;
length a $ 4;
set cert.input09;
a = substr(custID,3,4);
b = a*1000;
custID = tranwrd(custID,a,'9999');
run;
Try defining the A variable first with the proper type and length. You are replacing a character string, length of 4.
data results.output09;
length a $ 4;
set cert.input09;
a = substr(custID,3,4);
b = a*1000;
custID = tranwrd(custID,a,'9999');
run;
Thank you for your help.
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.