I would like to calculate the growth rate of several variables without doing it manually. Is there any smart way to do it?
E.g. See table below from sashelp.citiyr
that looks like:
DATE PAN PAN17 PAN18 PANF PANM
1980 227757 172456 138358 116869 110888
1981 230138 175017 140618 118074 112064
1982 232520 177346 142740 119275 113245
1983 234799 179480 144591 120414 114385
1984 237001 181514 146257 121507 115494
1985 239279 183583 147759 122631 116648
1986 241625 185766 149149 123795 117830
1987 243942 187988 150542 124945 118997
1988 246307 189867 152113 126118 120189
1989 248762 191570 153695 127317 121445
I can create the growth rate of the variables as follows (example for first column PAN
) but I would like a way to compute it for all the variables (or those I want, imagine a case with dozens of them).
data test;
set sashelp.citiyr;
by date;
Pan_growth = PAN / lag(PAN);
run;
Any idea how to make this smarter?