by armyid date;
run;
data result;
set temp;
by armyid ;
start=lag(date);end=date;
_rank=lag(rank);_pay=lag(pay); r=rank;p=pay;
if first.armyid then output;
else do;
output;
do i=start+1 to end-1;
date= i;rank=_rank;pay=_pay;
output;
end;
end;
if last.armyid and (end lt '31dec2009'd ) then do;
do j=end+1 to '31dec2009'd ;
date=j; rank=r;pay=p;
output;
end;
end;
drop i j r p start end _: ;
run;
proc sort data=result;
by armyid date;
run;
[pre]
[/pre]
Ksharp
datalines;
103164
O-1 $8.20
103164
O-3 $8.70
103164
O-5 $10.25
475405
E-4 $15.35
475405
E-6 $18.40
475405
E-8 $22.90
589071
O-7 $14.10
589071
O-9 $19.65
589071
O-11 $28.80
NOTE: Data set
WORK.RESULT contains 1 observations not in WORK.DAYS.
NOTE: Values of the following 4 variables compare unequal: ARMYID DATE RANK
PAY
NOTE: The data sets WORK.RESULT and WORK.DAYS contain unequal values.
NOTE: There were 2838 observations read from the data set WORK.RESULT.
NOTE: There were 2837 observations read from the data set WORK.DAYS.
NOTE: PROCEDURE COMPARE used (Total process time):
real time
1.78 seconds
cpu time
0.10 seconds
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.