Bookmark and Share

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: RE: reshape command ---listing all the variables changing over time?


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: reshape command ---listing all the variables changing over time?
Date   Fri, 14 May 2010 00:28:05 +0200

<>

So I have gone from "Mr. Weiss" to "Mr. Martin" in a matter of minutes :-)
Anyway, all those 1,500 -by-s may become annoying at some point, in which
case you want to take a hard look at -collapse- for your "second stage"...


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Amanda Fu
Sent: Freitag, 14. Mai 2010 00:22
To: [email protected]
Subject: Re: st: RE: reshape command ---listing all the variables changing
over time?

Dear Mr. Martin,

This is indeed more efficient! Using --by--, I do not need to reshape
into wide version at the second stage at all. It seems that in the
past I did not like to use --by--.  I have paid my price for this.
Anyway, I am still very happy to learn this now, because it is going
to be useful in the future.

Thank you!

Best wishes,
Mandy

On Thu, May 13, 2010 at 6:09 PM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> Why is it so important to -reshape- to "wide" to -summarize-? It can be
done
> in both data formats. To see the equivalence:
>
>
> ***********
> webuse reshape1, clear
> su inc??
> reshape long inc ue, i(id) j(year)
> bys year: su inc
> ***********
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Amanda Fu
> Sent: Donnerstag, 13. Mai 2010 23:56
> To: [email protected]
> Subject: Re: st: RE: reshape command ---listing all the variables changing
> over time?
>
> Thanks so much, Mr. Weiss!
>
> The reason I want to reshape the whole data set wide is that, I got
> from some coworkers a long-version data set (first stage).
> I reshape it into wide version to do some basic statistical
> description, such as the demographic characteristics ( gender, age,
> race, education description) (second stage).
> Then, I will reshape the data set back to long version to use the
> panel data methods such as fixed effect models (third stage).
>  I am required to keep all the variables in the third stage.
>
> Maybe I do NOT need to reshape all the demographic variables in the
> second stage; just include those variables?
>
> Thanks a lot!
> Mandy
>
> On Thu, May 13, 2010 at 5:44 PM, Martin Weiss <[email protected]>
wrote:
>>
>> <>
>>
>> ***********
>> ssc d panels
>> ***********
>>
>> may be helpful to check for constant variables within panels.
>>
>>
>> What kind of dataset is it that features 1,500 variables that you want to
>> -reshape- to wide? I would say that this is not a normal situation when
>> applying the -reshape- command. You will end up with a dataset with
> slightly
>> more than 1,500*(number of distinct values of j) variables. Is that
really
>> intended? Stata is fond of the "long" format for most analyses...
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Amanda Fu
>> Sent: Donnerstag, 13. Mai 2010 21:57
>> To: [email protected]
>> Subject: st:reshape command ---listing all the variables changing over
> time?
>>
>> Hi all,
>>
>> I was wondering if anyone could help me with a problem I met when
>> using --reshape--command.
>>
>> When I tried to reshape a data set from long version to wide version,
>> I find I  need to list all the variables that are not constant in the
>> --reshape--command. Suppose the data set has 1500 variables changing
>> over time and 100 constant variables.
>> ------------------------------------------------------------
>> . reshape wide x1-x1500, i(id) j(wave)
>> ------------------------------------------------------------
>> If I miss any of the variables changing over time, the reshape command
>> will give error message such as "variable XXXX not constant " and will
>> stop working.  But it is so frustrating to separate the constant
>> variables and not-constant variables and list all of the latter ones
>> in the reshape command.
>>
>> What I used to do is just to drop all the unnecessary variables from
>> the data set before reshape to reduce the work load here.
>>
>> May I know if there is any more efficient way to deal with this problem?
>>
>> Thanks for your time!
>>
>> Sincerely,
>> Mandy
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/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/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/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/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/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index