DATA Step, Macro, Functions and more

Why values starting with numerical values are not recognized in a data step

Reply
Super Contributor
Posts: 272

Why values starting with numerical values are not recognized in a data step

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

 

 

Super Contributor
Posts: 272

Re: Why values starting with numerical values are not recognized in a data step

I got the answer. 

Super User
Posts: 17,963

Re: Why values starting with numerical values are not recognized in a data step

Then pleas post the answer and mark the question solved. 

Ask a Question
Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 2 in conversation