|
I am compiling a migration history database using SIPP data for about
220,000 respondents over 48 months. I have a monthly indicator
(inter[i]) of whether a migration occured or not, and I have computed a
variable (intermig[i]) that represents whether a migration has occurred
in the past. I now need to compute a measure of the date of migration,
and have that variables stay be constant by migration. Here's an
example of what I want the data to look like (in long format).
t inter intermig cminter interview
0 0 0 0 616
1 0 0 0 617
2 1 1 618 618
3 0 1 618 619
4 0 1 618 620
5 0 1 618 621
6 0 1 618 622
My data is currently in wide format and so the code below effectively
creates 'intermig,' but the second part where cminter is computed does
not work, and I get zeros on all obs.
Is SAS not able to process the cminter[j]=interview[i] command?
Thanks for your help.
/*Interstate Migrants*/
do i=2 to 48;
if inter[i] eq 1 then do;
do j=i to 48;
intermig[j]=1;
end;
leave;
end;
else intermig[i]=0;
if inter[i] eq 1 then do;
do j=i to 48;
cminter[j]=interview[i];
end;
leave;
end;
else cminter[i]=0;
end;
|