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]
Re: st: Reshape issue
James Bernard <email@example.com>
Re: st: Reshape issue
Wed, 27 Feb 2013 17:54:07 +0800
Hi Nick and Richards,
Thanks for the suggestion.
Just to close the loop so that others who find our conversation on
statalist can benefit from this:
I used -collapse- plus -firstnm- which collapses the observations by
group to the first non-missing observation.
On Wed, Feb 27, 2013 at 5:37 PM, Richard Williams
> So, if I understand you correctly, with each additional year of data
> you added both another record for each firm and another variable
> (instead of just doing one or the other)? If so, how about something
> like (I am using pseudo code here)
> If not missing sales1990 then
> Year = 1990
> Sales = sales1990
> Repeat for each year in your data. You will then have a data set that
> has firm, year and sales (along with a lot of old variables you no
> longer want) and you will just need to xtset it.
> Sent from my iPad
> On Feb 27, 2013, at 4:12 AM, James Bernard <firstname.lastname@example.org> wrote:
>> Dear list members,
>> 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
>> 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-
>> I appreciate your help!
>> * 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: