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!
Totally forgot about that !!! Thx!
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;
Totally forgot about that !!! Thx!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.