Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: reshape long does not recognize negative date values


From   jean ries <[email protected]>
To   [email protected]
Subject   Re: st: reshape long does not recognize negative date values
Date   Wed, 15 Sep 2004 11:28:52 +0200

I think that variable names like p-1 , p-2 , ... are illegal in Stata. When doing an -insheet- , Stata ignores these names and labels these columns v1 , v2 , ... You could rename the variables such that the first quarter becomes p0, the second quarter becomes p1 etc. If the first quarter is e.g. 1959q3, then you could do the following:

. insheet using qp.csv
. reshape long p, i(permno) j(qtime)
. replace qtime = qtime - 2
. format qtime %tq

best wishes,

jean

At 22:51 14/09/2004, you wrote:

Hello,
I have a comma seperated (csv) file with quarterly data on variable p. The column headings are of the form p0, p1, etc for 1960q1, 1960q2. For periods prior to 1960 I labelled the columns p-1, p-2, etc for 1959q4, 1959q3.
I use the command :

insheet using qp.csv

to input the data into Stata.

Then I do the following:
reshape long p, i(permno) j(qtime)
format qtime %tq

Stata then creates variable v1, v2, v3, .... for all of the dates prior to 1960q1.

How should I specify the dates in the csv file so that Stata picks them up correctly?

Any help is greatly appreciated. Thank you.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index