Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: data management questions


From   David Bai <db555@mail.com>
To   statalist@hsphsun2.harvard.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index