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]
Re: st: Adding a variable to a panel dataset
From
Joerg Luedicke <[email protected]>
To
[email protected]
Subject
Re: st: Adding a variable to a panel dataset
Date
Tue, 2 Oct 2012 09:12:41 -0500
If I understand the problem correctly, you will need to -reshape long-
(see -help reshape-) your country dataset. You will then need a
country identifier that is the same in both of your datasets. If you
don't have such an ID yet you may want to create one. Then you can
simply merge country and firm-level data by this ID and year.
J.
On Mon, Oct 1, 2012 at 11:39 PM, Jason Hecht <[email protected]> wrote:
> Chris -
>
> A point of clarification:
>
> In the example that you provided, it appears that the "wpid" file has
> as many obs. as the "employee" file.
>
> My problem is that I have 7 different country dummy variables that
> identify where the individual firm is located. However, I want to
> create a single variable that will have the unemployment rate (from
> 1998 to 2008) mapped into each firm's panel.
>
> So let's say my "wpid" is called "unrate" (a text file) which will
> have 11 lines and 14 columns arrayed as:
>
> 1998 China 8.9 Fra 6.4 . . . US 5.4
> 1999 China 8.3 Fra 5.8 . . . US 4.5
> . . . . . .
> . . . . . .
> . . . . . .
> 2008 China 7.2 Fra 8.2. . . US 7.5
>
> where the above variables would be named as "year" "China" "RUNCChn"
> "Fra" RUNCFra" .... "US" "RUNCUS"
>
> Now I would need to merge the above dataset with my analagous
> "employee" dataset which has 155,386 firm-year panel observations
> (firm id #'s go from 1 to 14,126 and year (1998-2008) is a variable.
>
> I'm not sure if your FAQ example would work because I need to merge
> unempoyment rates for seven different countries into the firm-level
> panels.
>
> I'm sorry if I am misinterpreting the FAQ example. I'm relatively new
> to STATA and am learning how to use the programming commands.
>
> Kindly advise and thanks so very much for your help.
>
> Jason
>
> On Mon, Oct 1, 2012 at 7:04 AM, Christopher Baum <[email protected]> wrote:
>> On Oct 1, 2012, at 2:33 AM, Jason wrote:
>>
>>> I have constructed a panel dataset containing data on +14,000 firms
>>> from 1998 to 2008. I created a dummy variable that identifies the
>>> country where each firm is located (i.e., China, France, Germany,
>>> Japan, India, UK, or US).
>>>
>>> I now want to add the unemployment rate for each country that would
>>> map into each firm's panel. That is, I would like a single column that
>>> would match the country's unemployment rate to the panel of the
>>> individual firm.
>>>
>>> Is there a relatively easy way to do this?
>>
>> This is a FAQ:
>>
>> http://www.stata.com/support/faqs/data-management/group-characteristics-for-subsets/
>>
>> Kit
>>
>>
>> Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
>> An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
>> An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
>>
>>
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>> * http://www.ats.ucla.edu/stat/stata/
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/