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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.