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

I have data like:

 

Day    Current    Previous    Growth

1      10          5          1.0

2      20         10          1.0

3      30                    15          1.0

etc.

 

I would like to add another variable that creates a running total (RT) and running growth rate:

 

Day    Current    Previous    Growth    RT_Curr  RT_Prev   RT_Growth 

1      10          5          1.0       10        5        1.0

2      20         10          1.0       30       15        1.0

3      30                    15          1.0       60       30        1.0

etc.

 

Is there an easy way to do this in SAS?  Datastep?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
BCNAV
Quartz | Level 8

Totally forgot about that !!!  Thx!

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I can't determine from your example how running total growth is computed. Nevertheless, running totals are simple.

 

data want;
    set have;
    rt_curr+current;
    rt_prev+previous;
run;
--
Paige Miller
BCNAV
Quartz | Level 8

Totally forgot about that !!!  Thx!

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 590 views
  • 0 likes
  • 2 in conversation