Date: Fri, 12 May 2006 21:08:57 -0500
Reply-To: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jiann-Shiun Huang <Jiann-Shiun.Huang@AMERUS.COM>
Subject: Re: Simple Event history, 'ever occur' question
Content-Type: text/plain; charset=US-ASCII
Matt:
If your intermig indicates that there is an occurrence of
(interstate) migration in t or prior to t then try the following:
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;
end;
If this does not work for you, write back and provide more detail
infor and some sample dataset, if possible.
J S Huang
1-515-557-3987
fax 1-515-557-2422
>>> <mshall2@GMAIL.COM> 05/12/06 8:40 PM >>>
I'm with working a large dataset (N=~220,000) that has observations
for
48 months. I am computed a migration history, and I have already
established when a migration has occurred. I am trying create a
variable that indicates whether a migration occured any time in the
past. Here's an example (in long form) of what I want the data to look
like:
t is time, inter is occurence of (interstate) migration, and intermig
is the 'migrant' variable.
t inter intermig
1 0 0
2 0 0
3 1 1
5 0 1
6 0 1
7 0 1
Here's a portion of the code (the data is currently in wide form) I've
written so far, but the problem I'm running into is that a preceeding
ever migrant value of 0 will override subsequent values. Nobody can
move during the first month so the line ' intermig[1]=0' confirms
this.
array intermig(48); /*Inter mig occured at t or any t prior (t-k)*/
array inter {1:48} interstate_move1-interstate_move48;
intermig[1]=0;
do i=2 to 48;
/*Interstate Migrants*/
if inter[i] eq 1 then intermig[i]=1;
if inter[i] ne 1 then intermig[i]=0;
intermig[i]=intermig[i-1];
I realize this is a very novice question, but it's been bothering me
all evening. Thanks much for any help you can provide.
Matt Hall
Penn State