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

I have a large dataset where each rate is the same for all ages between age_first and age_last. Below is an example of one row of the dataset:

 

age_first   age_last   rate

   15             20         4.16

 

My goal is to convert this row into many, with one row for each age, like so:

 

age   rate

15     4.16

16     4.16

17     4.16

18     4.16

19     4.16

20     4.16

1 ACCEPTED SOLUTION
2 REPLIES 2
Reeza
Super User

Use those values as the do loop start and stop.

 

data want;
set have;

do age=age_first to age_list;
       output; *writes a record for each age;
end;

run;

@rav31 wrote:

I have a large dataset where each rate is the same for all ages between age_first and age_last. Below is an example of one row of the dataset:

 

age_first   age_last   rate

   15             20         4.16

 

My goal is to convert this row into many, with one row for each age, like so:

 

age   rate

15     4.16

16     4.16

17     4.16

18     4.16

19     4.16

20     4.16


 

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

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
  • 2 replies
  • 1301 views
  • 2 likes
  • 3 in conversation