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: Reshape issue
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Reshape issue
Date
Wed, 27 Feb 2013 09:57:47 +0000
I see now why you thought of -duplicates-. My suggestion will still work:
bysort Firm : gen newid = _n
reshape long sales_ , i(Firm newid)
drop if missing(sales_)
drop newid
Nick
On Wed, Feb 27, 2013 at 9:28 AM, Nick Cox <[email protected]> wrote:
> You can always supply arbitrary identifiers by
>
> bysort firm : gen newid = _n
>
> and then use -i(firm newid)- in the -reshape- call.
>
> You just have to remember that they are arbitrary.
>
> I can't see where -duplicates drop- would come in here. You don't have
> duplicates and even if you did they would be extra information.
>
> Nick
>
> On Wed, Feb 27, 2013 at 9:09 AM, James Bernard <[email protected]> wrote:
>
>> I was trying to reshape my dataset from wide to long, and realized
>> that the the identifier of each case has to be unique. The problem is
>> actually with the shape of my data-set. I cannot use -duplicates drop-
>> to do teh job due to the nature of my dataset which looks like this:
>>
>>
>> Firm sales_1990 sales_1991 sales_1992
>> -------------- -------------------- ------------------
>> -----------------------
>> ABC 10 missing missing
>> ABC missing 23 missing
>> ABC missing missing 15
>> CDF
>> .
>> .
>> .
>> GFP
>>
>>
>> it is panel data so the same thing goes for CDF and GFP
>>
>> As you can see, I cannot make the cases unique.
>>
>> Is there any way out of this quagmire?
>>
>> I was thinking about finding a command that can make the sales in each
>> year being repeated for each firm. Then I could use _duplicates drop-
>> command.
*
* 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/