I am using the below step to check if the variables are not missing than concatenate. can i use these sec1 and sec2 in macro call because i dont know how many sec.. will be coming later.
any idea?
if SEC1 ne '' and SEC2 ne '' then do; sec_r=catx(';', of SEC:);¨ end;
data _null_;
counter = countw(sec_all, ',');
do i=1 to counter by 2;
sec_cat = trim(catt("&sec_at", scan(sec_all, i, ','));
end;
run;
I am sorry, I don't follow you. The catx(';',of sec:) will concatenate all non missing variables with prefix sec together. I don't see where the need to use macro or check missing comes from? Please provide good examples - post test data in the form of a datastep and what you expect as output. Remember macro SAS is not a replacement for Base SAS, and doesn't do anything magical.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.