Hi Everyone,
I have few string var1 var2 var3.
I want to add all 3 strings and between each string, I want to have 3 spaces.
I try: new_var=cats(var1, " ", var2, " ", var3)
But it doesn't work.
Any suggestion, please.
Thank you.
HHCFX
use catx
new_var=catx( " ", var1,var2,var3)
The function cats uses strip+trim on each argument, so nothing is appended. Using catx - as suggested by @novinosrin - solves the issue.
Hello,
You have to use catx function as suggested by novinosrin Sir. or you can use call routine call catx().
data _null_;
length var1 $20.;
var2="Hello";
var3="SAS";
call catx(' ',var1,var2,var3);
put var1=;
run;
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 save with the early bird rate—just $795!
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.