Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The trouble with Lag.

Status
Not open for further replies.

Asender

Programmer
Jun 4, 2003
31
GB
Hi all.

Can anyone explain why the does not work :

data AS.DATE_FILL;
set AS.SORTHIST;
by POLICY;
if not first.POLICY then
do;
if date6 = . then date6 = lag(date6);
end;
if date6 = . then delete;
if date3 = . then delete;
run;

And this does :

data AS.DATE_FILL;
set AS.SORTHIST;
by POLICY;
held_date6 = lag(date6);
if not first.POLICY then
do;
if date6 = . then date6 = held_date6;
end;
if date6 = . then delete;
if date3 = . then delete;
run;

Thanks.

 
Lag doesn't work correctly in a loop. (if, else and last but not least do's and ends)

Why not use the retain statement?
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top