Here is the one with simple logic.
1512 data need;
1513 set a end=end;
1514 by acct;
1515 n=_n_+1;
1516 if end=0 then set a (keep=sales rename=(sales=sales2)) point=n;
1517 if last.acct then sales2=.;
1518
1519
1520 run;
NOTE: There were 5 observations read from the data set WORK.A.
NOTE: The data set WORK.NEED has 5 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
1521
1522 proc print; run;
NOTE: There were 5 observations read from the data set WORK.NEED.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Obs acct sales sales2
1 1 23 33
2 1 33 54
3 1 54 .
4 2 32 34
5 2 34 .
|