BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sathish_jammy
Lapis Lazuli | Level 10

i tried up whith this condition.

But the 89 series are come up as null ... Why?

data cre_epi;
set creatin7;
if epi_1 ge 90 then  
	epi_1_stage =1; 
if epi_1 ge 60 and epi_1 le 89 then 
	epi_1_stage =2; 
if epi_1 ge 30 and epi_1 le 59 then 
	epi_1_stage =3; 
if epi_1 ge 15 and epi_1 le 29 then 
	epi_1_stage =4; 
if epi_1 lt 15 then 
	epi_1_stage =5; 
if epi_1 =. then 
	epi_1_stage =.; 
if epi_5 ge 90 then
	epi_5_stage =1;
if epi_5 ge 60 and epi_5 le 89 then 
	epi_5_stage =2; 
if epi_5 ge 30 and epi_5 le 59 then 
	epi_5_stage =3; 
if epi_5 ge 15 and epi_5 le 29 then 
	epi_5_stage =4; 
if epi_5 lt 15 then 
	epi_5_stage =5; 
if epi_5 =. then 
	epi_5_stage =.; 
run;
mnoepi_1epi_5epi_1_stageepi_5_stage
12443875.38789.8752.
12441282.07182.07122
11295689.944...
1 ACCEPTED SOLUTION
3 REPLIES 3
PaigeMiller
Diamond | Level 26

The value of 89.875 doesn't satisfy any of your conditions. It is not greater than 90. It is not between 60 and 89. etc.

--
Paige Miller
RW9
Diamond | Level 26 RW9
Diamond | Level 26

This looks more like a job for formats anyways. 

proc format;
  value creatin
    1-15=5
    15-30=4
    30-60=3
    60-90=2
    90-high=1
    other=.;
run;

data want;
  set have;
  format epi_1 epi_5 creatin.;
run;
  

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 927 views
  • 4 likes
  • 4 in conversation