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 wide with 'repeated' observations
From
<[email protected]>
To
<[email protected]>
Subject
RE: st: reshape wide with 'repeated' observations
Date
Tue, 18 Feb 2014 23:08:21 +0000
Chi-chi,
If Stata reports that values are not unique within studyid, this means that somewhere you have two (or more) entries with the same date for a given id. This has nothing to do with whether the values in the "level" variable are unique or not. Are you sure there are no duplicate dates within each 'id' and/or that the dimensions of the panel have been correctly defined (e.g., using the -xtset- command)?
Vassilis
Sent from my Android phone using TouchDown (www.nitrodesk.com)
-----Original Message-----
From: Nick Cox [[email protected]]
Received: Tuesday, 18 Feb 2014, 22:53
To: [email protected] [[email protected]]
Subject: Re: st: reshape wide with 'repeated' observations
OK; so why do you want to do that?
Nick
[email protected]
On 18 February 2014 20:46, Ojinnaka, Chinedum <[email protected]> wrote:
> I am sorry about the confusion. Yes, the data is in long form and I want to reshape it to a wide form. However, because some of the observations have similar values like in the table I provided. Stata says the values are not unique to the id. I am wondering if there is a way to get around this problem.
>
> Thank you.
> Chi-Chi
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: Tuesday, February 18, 2014 1:37 PM
> To: [email protected]
> Subject: Re: st: reshape wide with 'repeated' observations
>
> Your title says "reshape wide" but you say you want to "reshape from wide to long". Stata means "reshape to wide" when it says "reshape wide" and similarly for "long".
>
> In your case, the example data appear to be already in long form with identifier repeated for each observation. For most panel or longitudinal tasks, this is what you need, so if I understand you correctly, there is no problem to be fixed.
>
> Nick
> [email protected]
>
> On 18 February 2014 17:05, Ojinnaka, Chinedum <[email protected]> wrote:
>
>> I want to reshape a dataset from wide to long. The variable of interest is a measure that can be repeated multiple times with the same measurement (example provided in table below), thus, I received an error message saying that values of the variable are not unique within the studyid. Is there anything that can be done about this?
>>
>> id date level
>> 1 02202004 5.6
>> 1 04202004 5.4
>> 1 06202004 5.6
>
> *
> * 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/
Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
*
* 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/