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]

st: RE: Reshape question


From   "Cohen, Elan" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Reshape question
Date   Fri, 29 Mar 2013 18:25:00 +0000

How about this:

foreach var of varlist var2-var4 {
	rename `var' VoI`=`var'[1]'
}
drop in 1
rename var1 date
g id = _n
reshape long VoI, i(id) j(firmid)
drop id

HTH, 

- Elan


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of thomas bourveau
Sent: Friday, March 29, 2013 14:10
To: [email protected]
Subject: st: Reshape question

Dear Statlist readers,

I now have an issue trying to reshape my dataset.

Currently, a simplified version of my dataset looks as follows :

var1                      var2                    var3                   var4
Code                    111111              111112               111113
01/01/2000             10                        11                       22
01/02/2000             20                        14                       25
..
..
01/12/2008             23                        17                        28


Specifically, my columns name are var1, var2, var3....
In the first line of the dataset, except for the first column, there
is the firms identifier.
As you can see from my example, the next lines provide the value of my
variable of interest for all the firms in the sample at a given point
in time.

I need to work with a dataset that would be organized as follows :

Firm ID         Date                      Variable of Interest
111111         01/01/2000                     10
..
..
111111         01/12/2008                      23
111112         01/01/2000                      11
..
..
111112         01/12/2008                     17
111113         01/01/2000                      22
..
..
111113         01/12/2008                      28


I have been through several stata tutorials online. However, I do not
think that my case fit with the basic wide / long reshape examples
that I've found.

I would appreciate any suggestion to find a solution.

Best,
Thomas

--
Thomas Bourveau
[email protected]
0637573925
*
*   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/


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