Dear,
Thanks for your excellent support.
I am trying to create a variable from data1. But I am getting the output value for last OBS only. Why. Please help. Thanks.
my code:
data one;
set data1;
if trta='75 mg' then trt='A';
if trta='150 mg' then trt='B';
if trta='300 mg' then trt='C';
if trta='TOTAL' then trt='D';
run;
data1;
ns trta
50 100 mg
60 25 mg
70 125 mg
180 Total
my code:
data one;
set data1;
if trta='100 mg' then trt='A';
if trta='25 mg' then trt='B';
if trta='125 mg' then trt='C';
if trta='TOTAL' then trt='D';
run;
ouput getting:
ns trta trt
50 100 mg
60 25 mg
70 125 mg
180 Total D
I got the answer.
Then pleas post the answer and mark the question solved.
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.