02-27-2014 08:50 AM
I have the following table and I would like to calculate the rate of change between individual years. The second table is my desired output. It can be done easily in excel, but it is a small step of a large sas code and I would rather not interrupt the process... Any ideas?
|Year||Percentage||Change from Prev Year|
02-27-2014 09:10 AM
create table want as
t1.percentage / t2.percentage as ChangeFromPrevYear
left outer join have t2
02-27-2014 10:56 AM
Your approach might be easier for this case. Most of the time I revert to sql as that's what I grew up with and it seems to be a bit more straightforward if you end up needing more complex criteria than just the previous record. Also, the data must be sorted for the data step approach...not necessary for sql (although you probably would want it sorted just to help performance).
Need further help from the community? Please ask a new question.