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 long not recognizing the right j values
From
Steve Samuels <[email protected]>
To
[email protected]
Subject
Re: st: reshape long not recognizing the right j values
Date
Sun, 28 Jul 2013 09:25:36 -0400
. reshape long v, i(id) j(date) string
fixes things.
Steve
On Jul 28, 2013, at 9:08 AM, László Sándor wrote:
Thanks, Nick.
My mistake about the dashes, -insheet- does eliminate them, I was
looking at my original csv. Sorry.
Here is a simple example (without the output, of course). Do you agree
this should not happen?
clear all
input id v19990129 v19990226 v19990331
1 1 2 3
2 4 5 6
end
de
reshape long v, i(id) j(date)
de
exit
Thanks,
Laszlo
On Sun, Jul 28, 2013 at 5:27 AM, Nick Cox <[email protected]> wrote:
> Once again, please provide a reproducible example, with complete
> illustrative data and code.
>
> I don't understand how variable names can include dashes "-", for a start.
>
> Off-by-one errors sound like the result of using an inappropriate
> storage type. If -reshape- does that, it sounds like a bug.
>
> Nick
> [email protected]
>
> On 28 July 2013 00:43, László Sándor <[email protected]> wrote:
>
>> I am using Stata/MP 12.1 for Windows for this. I have irregular
>> variable name endings corresponding to dates close to the last trading
>> day of months. Thus the spacing of these values is irregular. (There
>> are also dashes between the composites of dates, but Stata seems to
>> have no problems with that.)
>>
>> What I don't understand is that when I ask for -reshape long, i()
>> j(date)- Stata recognized a subset of the j-values, but was looking
>> for the wrong ones for others (one day off for some months) and thus
>> of course it did not reshape all months' values.
>>
>> E.g. my variables start with ...1999-01-29, ...1999-02-26,
>> ...1999-03-31, and Stata tried to find j-values 19990128, 19990226,
>> 19990332. Of course, it only found the middle one, and did not reshape
>> the other two.
>>
>> I do not see the logic in what j-values reshape was looking for --- if
>> you think about it, date strings in numerical form rarely follow any
>> nice pattern (no arithmetic series or anything). So why did it
>> recognize some of the values but were looking for the wrong ones in
>> other cases?
>
> *
> * 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/