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.
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.