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

st: RE: Generate variable


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Generate variable
Date   Mon, 9 May 2005 09:51:36 +0100

kelly johnson
 
> (2) I am using the stata -rolling- command (new to stata 9) 
> to generate 
> rolling correlations. if i declare my data set to be a time 
> sereis dataset 
> using the date variabe (format: %dD_m_Y) it doesn't work. 
> however, when i 
> use a new variable for observations (eg. like the one above, 
> where it equals 
> 1 for the first obs, 2 for the second observation, ...) and 
> declare the data 
> to be time series (tsset) on this variabel, it works. Why?

This question is very difficult to answer given the vagueness
of "doesn't work" and what you say about your dataset. However, 
it sounds as if you have a problem. Using observation number 
as time identifier amounts to an assumption that you 
have consecutive observations. You should get equivalent 
results with the real dates. Also, just in case you are not 
aware of it, using the observation number as 
time variable would certainly be incorrect if you have panel 
data. 

> (3) also, can you refere me to a good site where i can get 
> more information on writing loops?

What kind of information? 

Nick 
n.j.cox@durham.ac.uk 


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index