Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: data management questions
From
David Bai <[email protected]>
To
[email protected]
Subject
st: data management questions
Date
Sat, 21 Aug 2010 06:51:45 -0400
Dear all,
I have two questions regarding data management, and would
appreciate it if anybody can help.
(1) If I have a datafile like this:
ID(individual id) NID(neighborhood id)
1 100
2 100
3 104
4 102
5 104
How can I create a datafile for neighborhood ID variable like this?:
NID
100
102
104
(2) Now since I have the complete list of NIDs (suppose there are 100
neighborhoods), I'd like to use this NID file to merge with another
data file (dataset Two, which has neighborhood ID variable and
time-varying variables. Dataset Two has 200 neighbors) like this:
NID year var1
100 1 850
100 2 600
101 1 90
102 1 600
102 2 400
103 1 500
103 2 400
103 3 506
I only want to keep the 100 neighborhoods that appear in the NID file,
What syntax I can use to merge the two data files for the 100
neighbors? Thank you very much.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/