BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

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

 

 

2 REPLIES 2
Reeza
Super User

Then pleas post the answer and mark the question solved. 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1056 views
  • 0 likes
  • 2 in conversation