BookmarkSubscribeRSS Feed
CathyVI
Lapis Lazuli | Level 10

Hi,

This might be very simple but I will like to find the median (IQR) of an age variable. The age variable is in character format and the code is three digits. Here is an example:

data have;
input Age $;
datalines;
042
043
055
035
065
066
070
098
;
run;

I thought about removing the 0 before converting data to numeric but I don't know how. Is this a meaning idea ? 

 

2 REPLIES 2
sbxkoenk
SAS Super FREQ
data have;
input Age $;
datalines;
042
043
055
035
065
066
070
098
;
run;

data have1;
 set have;
 AgeNum=input(Age,3.);
run;

proc means data=have1 median qrange fw=8;
 var AgeNum;
 output out=want median= qrange= / autoname;
run;
/* end of program */

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
  • 1123 views
  • 0 likes
  • 3 in conversation