BookmarkSubscribeRSS Feed
ash2000
Calcite | Level 5

how to write a syntax to compute 'median age' for a population using sas 

example

age group                             population

0-4                                           200

5-9                                           250

10-14                                       320

15-19                                       600

20-24                                       435

2 REPLIES 2
andreas_lds
Jade | Level 19

@ash2000 wrote:

how to write a syntax to compute 'median age' for a population using sas 

example

age group                             population

0-4                                           200

5-9                                           250

10-14                                       320

15-19                                       600

20-24                                       435


Is this an example of your input-data or the requested result?

 

 

Reeza
Super User

In a case like this you don't really have a good way to find the median. 

 

You can determine the total, which is1805, and the middle is 903ish, which means the 'median' is 15-19. 

 

If you had exact ages you could do an actual calculation, but I don't believe that SAS has a method for computing medians when data is in this format. 

 

 

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