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: -reshape- and variable names involving zero (0)


From   Richard Williams <richardwilliams.ndu@gmail.com>
To   statalist@hsphsun2.harvard.edu, Stata Help <statalist@hsphsun2.harvard.edu>
Subject   Re: st: -reshape- and variable names involving zero (0)
Date   Sun, 27 Oct 2013 17:31:28 -0500

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:  Richard.A.Williams.5@ND.Edu
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/


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