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]
AW: st: RE: AW: AW: RE: AW: RE: Transposing datasets
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
AW: st: RE: AW: AW: RE: AW: RE: Transposing datasets
Date
Mon, 2 Aug 2010 15:52:32 +0200
<>
" Indeed, I have stored datadate in %td- format, which
caused my problems with the reshape command."
The display -format- should not matter at all, I think, for -reshape- purposes. This code runs w/o problems:
*************
clear*
inp gvkey str10 datadate mcap_sum
212782 30jun2005 4946.9
212782 31jul2005 5042.1
212782 31aug2005 5145
212782 30sep2005 5302.5
212782 31oct2005 5253.5
212782 30nov2005 5642.7
212782 31dec2005 6230
212783 30jun2005 496.9
212783 31jul2005 502.1
212783 31aug2005 515
212783 30sep2005 530.5
212783 31oct2005 523.5
212783 30nov2005 562.7
212783 31dec2005 630
end
li, noo sepby(gvkey)
gen datadate2=date(datadate, "DMY")
form datadate2 %td
drop datadate
reshape wide mcap, i(gvkey) j(datadate2)
foreach var of varlist mcap_sum*{
ren `var' `=subinstr("`var'", "mcap_sum", "date_", 1)'
}
l
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Kaspar Dardas
Gesendet: Montag, 2. August 2010 15:44
An: [email protected]
Betreff: Re: st: RE: AW: AW: RE: AW: RE: Transposing datasets
Hey,
thanks guys. Indeed, I have stored datadate in %td- format, which
caused my problems with the reshape command.
Now all works fine.
Best,
Kaspar
2010/8/2 Nick Cox <[email protected]>:
> No arguments here.
>
> Sometimes we all just want to get results quickly and accurately, and
> care not a jot about logic. Sometimes understanding exactly what is
> going on is the best prescription because it is all too likely that your
> next such problem will not be identical and you will need to know how to
> change the solution.
>
> Nick
> [email protected]
>
> Martin Weiss
>
> Nick himself advocated "first principles" in
> http://www.stata.com/statalist/archive/2010-05/msg01165.html, btw...
>
> Martin Weiss
>
> "( Also, I learned something about using subinstr() in the rename
> command
> from your post, thanks )"
>
> Cheers! I love to work from first principles whenever possible, so my
> use of
> -subinstr()- was not intended to detract from the appeal of NJC`s
> -findit
> renvars-...
>
> Eric Booth
>
> ( Also, I learned something about using
> subinstr() in the rename command from your post, thanks )
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/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/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/