Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: [merging US industry level data]


From   Scott Cunningham <[email protected]>
To   [email protected]
Subject   Re: st: [merging US industry level data]
Date   Fri, 29 Sep 2006 09:44:54 -0400

Goodness. I've been attaching -uniqusing- to the end of the merge, and that was creating the problem. Works fine. I'm stupid. Thanks Michael. -sc

On Sep 29, 2006, at 9:23 AM, Michael Blasnik wrote:


...
It looks like you can just use a straight -merge- (called a many-to- one merge, but that doesn't matter) without any reshaping or creating some new combined variable. You certainly do not want to append. If both datasets are sorted, you can just:

merge state year using USING

Stata may issue a warning about lack of unique identification in the master dataset, but you can ignore that since you know that is what you expect/intend.

Michael Blasnik

----- Original Message ----- From: "Scott Cunningham" <[email protected]>
To: <[email protected]>
Sent: Friday, September 29, 2006 9:08 AM
Subject: Re: st: [merging US industry level data]
<snip>>

Not to butt in, but can you elaborate? I have two datasets currently: one on health outcomes where the panel identifier is a state variable which varies over time, and another dataset (the master dataset) where the panel identifier is a state, race, age, and sex specific cell that varies over time. The health data is from 1980-2000, while the master dataset is from 1970-2000. Originally I was using -joinby- but it was causing the master data to drop the 1970-1979 years. So I was going back to - merge-, and had planned to - reshape- the data down to a level where the merge could occur between using and master datasets. But are you saying here that -append- might be better, where a dummy variable indicating the using from the master data? But won't this just extend the length of the master data? For instance, say the data is:

<snip>
My thought was to reshape vbl1 by sex, age and race, as I was saying, so as to create a single state observation, and then merging on that state using the using data. But are you saying that it's easier to use append? Wouldn't it just add teh data to bottom of the master data?
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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