Dear,
I need to help in my code in data step two below. In my actual program i had to create a macro variable using proc sql and use it in a data step similar to below.
In data step two below, i need to create variable 'C' with value='TREATEMENT A Respond'. But i am getting errors. Please help. Thank you
%let treat1=TREATMENT A;
%put &treat1.;
data one;
input a b $;
datalines;
1 a
2 b
;
data two;
set one;
if b='a' then do;
c=&treat1.|| 'respond';
end;run;
%let treat1=TREATMENT A;
%put &treat1.;
data one;
input a b $;
datalines;
1 a
2 b
;
data two;
set one;
if b='a' then do;
c="&treat1."|| 'respond';
end;run;
Correction was c="&treat1."|| 'respond';
data two;
set one;
if b='a' then do;
c=catx(' ',"&treat1.","respond");
end;
run;You may also use the CATX function.
Most simple method:
data two;
set one;
if b = 'a' then c = "&treat1. respond";
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.