Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: creating networking effect, by using birthstate of migrant


From   "philippe van kerm" <[email protected]>
To   <[email protected]>
Subject   RE: st: creating networking effect, by using birthstate of migrant
Date   Tue, 19 Jun 2007 10:11:48 +0200

> Date: Mon, 18 Jun 2007 14:12:24 -0400 (EDT)
> From: "Ms. Marilyn Ibarra" <[email protected]>
> Subject: st: creating networking effect, by using birth state of
> migrant
> 
> I have the following data:
> Person    = observation
> State     = the state person currently resides in
> Born      = Birth state
> 95        = state where the person resided in 1995
> Native    = if person lives in state where they resided 1995
> Immigrant = person does not lived in state where they resided in
> 1995
> Return = person lived in USA in 1995
> 
> So what I need to do is create a variable that gives me the number
> of immigrants and return migrants to state k that were born in
> state i.
> 
> 
> Person State(k)  Born(i)  95   Native   Immigrant  Return
> 1         CO     CO      CO         1         0         0
> 2         NL     BC      BC         0         1         0
> 3         DF     NL      QTO        0         1         0
> 4         DF     JL      USA        0         1         1
> 5         CO     DF      DF         0         1         0
> 6         NL     BC      BC         0         1         0
> 
> So where I would additionally have a variable network,  something
> like this:
> 
> Person   Network
> 1           0
> 2           2
> 3           1
> 4           1
> 5           1
> 6           2
> 
> Any ideas, what is the best way to construct this variable
> "network"?

This looks like a problem for -by- and explicit subscripting (see [U]
13.7.2).

Try

 	bysort State Born immigrant : gen Network = _N*(immigrant)

(I'm not sure I fully understand your problem, though. So, you'd better
double-check this does what you want!) 

Hope this helps

Philippe




**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept 
**********************************************************************



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index