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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.