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: Merge Files one to many


From   <theodroe@bellsouth.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Merge Files one to many
Date   Sat, 31 Mar 2012 20:00:24 -0400

Have two data sets with common variable. The teacher data set has several
teachers per school. The school variable is a nominal variable that is
unique to each school. So if there are 20 teachers in a school the school
variable is repeated 20 times. The principal data file has one principal per
school and I want to merge/match on school. There is one principal to each
school and this file uses the same school variable to identify the school
the principal is in. What I need to do is to match the principal data to
every teacher in that school. 

So the file would look like:


School	teacher_var1	teacher_var2	principal_var1
123		23			45			56	
123		25			44			56
123		21			43			56
123		56			55			56
331		21			22			51
331		21			29			51
331		26			21			51

Help please
		

*
*   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