data A;
input acct sales;
cards;
1 23
1 33
1 54
2 32
2 34
;run;
data b;
retain point 1;
if _N_ < nobs then do;
point = point + 1;
set a point=point nobs=nobs;
lead= sales;
end;
set a end=end;
run;
proc sort data=b;by acct;run;
data b;set b;by acct;
if last.acct then lead=.;run;
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