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- and variable names involving zero (0)
From
Roberto Ferrer <[email protected]>
To
Stata Help <[email protected]>
Subject
Re: st: -reshape- and variable names involving zero (0)
Date
Sun, 27 Oct 2013 22:25:46 +0000
I see it now.
Thank you Richard.
Bests,
Roberto
On Sun, Oct 27, 2013 at 10:31 PM, Richard Williams
<[email protected]> wrote:
> Also see Nick Cox's FAQ:
>
> http://www.stata.com/support/faqs/data-management/problems-with-reshape/
>
> "On occasion, people use numeric suffixes with leading zeros, such as 01,
> 02, and so forth. reshape will understand these properly only if they are
> declared as string."
>
>
> At 03:43 PM 10/27/2013, Roberto Ferrer wrote:
>>
>> This derived from
>>
>> http://www.stata.com/statalist/archive/2013-10/msg00949.html
>>
>> The following does not give the result I would expect:
>>
>> *------------------------ begin code
>> ----------------------------------------
>> clear
>> input id str4 ticker str20 type return06 return07 return08
>> 1 "ABCB" "formation" 0.01 0.2 0.3
>> 2 "AEDU" "formation" 0.02 0.4 0.5
>> 3 "AMBV" "formation" 0.01 0.2 0.3
>> 1 "ABCB" "buysell" 0.01 0.2 0.3
>> 2 "AEDU" "buysell" 0.01 0.2 0.3
>> 3 "AMBV" "buysell" 0.01 0.2 0.3
>> 1 "ABCB" "holding" 0.01 0.2 0.3
>> 2 "AEDU" "holding" 0.01 0.2 0.3
>> 3 "AMBV" "holding" 0.01 0.2 0.3
>> end
>>
>> reshape long return, i(id type) j(period)
>> list
>> *--------------------- end code
>> ------------------------------------------------
>>
>> In the output I can see:
>>
>> xij variables:
>> return6 return7 return8 -> return
>>
>> which I believe should be:
>>
>> return06 return07 return08
>>
>> Notice the zeros are cropped out.
>>
>> If I rename return06, return07, return08 to
>> return16, return17, return18, the code returns what I expect.
>>
>> What am I missing? What's the problem with the original names
>> and -reshape- ?
>> *
>> * 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/
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME: (574)289-5227
> EMAIL: [email protected]
> WWW: http://www.nd.edu/~rwilliam
>
> *
> * 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/