I have the following panel data of 500 individuals for 60 months. data have;
do i=1 to 500;
do j="1jan2016"d to "31dec2020"d;
x=rannor(1);
if j=intnx("month",j,0,"end") then output;
end;
end;
run; And suppose I want to add lag(x) with SQL as follows. proc sql;
create table want as
select a.*,b.x as x1
from have a join have b on a.i=b.i and intnx("month",a.j,0)=intnx("month",b.j,1);
quit; And I found that altering intnx("month",a.j,0)=intnx("month",b.j,1) by intck("month",a.j,b.j)=-1 makes the proc sql slower—why is this the case?
... View more