I have a master dataset A:
Var1 Var2 Var3
X 50 201704
Y 100 201705
Z 150 201704
Var1 - String Var2 - Numeric Var3 - Date yymmn6.
I want to extract var2 from previous 3 months datasets (similar histpry datasets) for all these records.
Say, for X and Z i need var2 variable from datasets of 201703, 201702 & 201701. And for Y i need var2 from datasets of 201704, 201703 and 201702.
And then i have to calculate the sum of all the var2 for each observation.
I believe it's a sas macro work. I am not able to show my code since the data is much more complicated.
Can someone please help in getting this cracked?