Hello
There is a row data file with 5 rows for each customer.
Requirements:
1- Create a new field called "PCT1" that calculate PCT change between each 2 consuctive rows for each customer (in X)
2- Create a new field called "Ind1" that get 3 possible values:
IF PCT1>50% then get value 1
IF PCT1<-50% then get value -1
else get value 0
3- Create a new field called "value_after_Increase"
that get value of varaible X when varaible PCT1 =1
4-Create a new field called "value_after_Deccrease"
that get value of varaible X when varaible PCT1 =-1
5-Create a new field called "Location" that get value of location (row number)
when varaible PCT1 =1
Data Raw_tbl;
input ID ddate X;
cards;
111 1905 10
111 1906 10
111 1907 10
111 1908 17
111 1909 17
222 1905 20
222 1906 20
222 1907 20
222 1908 20
222 1909 20
333 1905 15
333 1906 15
333 1907 27
333 1908 27
333 1909 15
;
run;