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

st: Data Management

From   Rijo John <>
To   stata <>
Subject   st: Data Management
Date   Thu, 28 May 2009 10:32:44 -0500

Hello statalist,

I have a data set as below.

Ste fips	Year	tax
AL	 1	1965	 6.3
AK	 2	1965	 8.0
AZ	 4	1965	 4.3
AR	 5	1965	 7.7
CA	 6	1965	 3.0
CO	 8	1965	 4.2

Its a panel data for all 51 states running from year 1965 through 2008.

I want to generate few new variables from it. Basically I want to
create one variable for each neighboring states as n1 n2 n3 and son
on.I have another data that shows the neighborhood information as

Ste  n1	n2	n3	n4	n5	n6	n7	n8
AL	FL	 GA	 MS	 TN				
AK	NONE							
AZ	 CA	 CO	 NV	 NM	 UT			
AR	 LA	 MS	 MO	 OK	 TN			
CA	 AZ	 NV	 OR					
CT	 MA	 NY	 RI					

Here, for the state AL the values for n1 n2 & n3 should be the values
of "tax" in FL, GA, and TN respectively for the respective years.
Similarly for AK all the n's will be empty. and for AZ, n1 to n5 will
take values of the variable tax in CA, CO, NV. NM and UT respectively
for the respective years.
There is a maximum of only 8 neighbors for a state and minimum zero.
Can someone advise me how I can proceed with it?

Thanks in advance.
*   For searches and help try:

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