BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shanky_44
Obsidian | Level 7

Hello everyone, 

 

I want to change(replace) values in sashelp.class for weight/height/age variables. this is just for understanding the concept. Suppose this our data :

Obs Name Sex Age Height Weight

1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
7 Jane F 12 59.8 84.5
8 Janet F 15 62.5 112.5
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
11 Joyce F 11 51.3 50.5
12 Judy F 14 64.3 90.0
13 Louise F 12 56.3 77.0
14 Mary F 15 66.5 112.0
15 Philip M 16 72.0 150.0
16 Robert M 12 64.8 128.0
17 Ronald M 15 67.0 133.0
18 Thomas M 11 57.5 85.0
19 William M 15 66.5 112.0

 

I am willing to change weight variable values to 9999 if the observation is between 120 - 150. Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
ehmsoleil
Fluorite | Level 6

data new; 

set help.class;

if 120 <= weight <= 150 then weight = 9999;

run;

 

View solution in original post

2 REPLIES 2
ehmsoleil
Fluorite | Level 6

data new; 

set help.class;

if 120 <= weight <= 150 then weight = 9999;

run;

 

shanky_44
Obsidian | Level 7

Thanks, it is working fine. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

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
  • 1158 views
  • 1 like
  • 2 in conversation