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 from wide to long
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Reshape from wide to long
Date
Wed, 20 Nov 2013 19:25:38 +0000
Show us sample data, please.
Nick
[email protected]
On 20 November 2013 19:19, Lars Folkestad <[email protected]> wrote:
> Dear Nick, and statalisters
>
> Ah i see. But now i have a problem i don't know how to solve. My variables
> in WIDE format are:
>
> Id
> patientId
> Name
> varA
> varB
> measurmentA1
> measurmentB1
> measurmentC1
> measurmentA2
> measurmentB2
> measurmentC2
>
> When i go:
> reshape long Name VarA VarB measurementA measurmentB measurmentC, i(Id)
> j(visit)
>
> I get a error message: r(110) patientID already defined
>
> What am i doing wrong?
>
> Lars
>
> Den 18/11/13 22.21 skrev "Nick Cox" <[email protected]>:
>
>>The key is that -reshape- wants stubs, not variable names. See
>>
>>FAQ . . . . . . . . . . . . . . . . . . . . . . . . Problems with
>>reshape
>> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.
>>J. Cox
>> 8/05 I am having problems with the reshape command. Can
>> you give further guidance?
>> http://www.stata.com/support/faqs/data-management/
>> problems-with-reshape/
>>
>>which is support for the manual entry.
>>Nick
>>[email protected]
>>
>>
>>On 18 November 2013 20:35, Lars Folkestad <[email protected]>
>>wrote:
>>> Hello
>>>
>>> I want to a data set of repeated measurments. I want to reshape the
>>>data from wide to long seeing i want to show individual data change over
>>>time in a graph I have 2 measurments.
>>>
>>> Each case have a patient number and a id - both unik identifiers.
>>>
>>> The first five variables are there only once: id var0a var0b var0c var0d
>>>
>>> When i write:
>>> .reshape long varA1 varB1 varC1 varA2 varB2 varC2, i(PatNo) j(visit)
>>>
>>> Stata gives out an error saying no variables a# b# was found.
>>>
>>> What am i doing wrong?
>>>
>>> Mvh Lars Folkestad
>>> *
>>> * 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/
*
* 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/