BookmarkSubscribeRSS Feed
Bumble_15
Fluorite | Level 6

Hello,

This may be a silly question, but I have a dataset with a variable "age" that is continuous, but contains "<1". I am looking to replace the "<1" with a range of numeric values (0.3-0.7). 

 

I'm not sure of the best way to go about this; my initial thought was multiple imputation (proc MI), but I think there must also be another (simpler) way. 

 

Thank you!

3 REPLIES 3
PaigeMiller
Diamond | Level 26

According to PROC CONTENTS, is this variable that is named AGE, numeric or character? The only acceptable answer is from PROC CONTENTS. Show us the PROC CONTENTS output.

--
Paige Miller
Tom
Super User Tom
Super User

@Bumble_15 wrote:

Hello,

This may be a silly question, but I have a dataset with a variable "age" that is continuous, but contains "<1". I am looking to replace the "<1" with a range of numeric values (0.3-0.7). 

 

I'm not sure of the best way to go about this; my initial thought was multiple imputation (proc MI), but I think there must also be another (simpler) way. 

 

Thank you!


You seem confused about what you have.  If the value has a < in it then it is NOT a number.  It is a character string.  If the new value has a hyphen in it then it is also not a number.

 

So you want to replace the string '<1' with the string '0.3-0.7'. 

 

As long as AGE is defined long enough to hold that longer string it should be easy.

data want;
  set have;
  if age='<1' then age='0.3-0.7';
run;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1437 views
  • 0 likes
  • 4 in conversation