Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: extract data points from series


From   "d.cyril" <[email protected]>
To   Statalist <[email protected]>
Subject   st: extract data points from series
Date   Sat, 24 Mar 2007 14:15:25 +0000

Hello,

I've been using Stata for some time now but still don't find myself
native when it comes to data manipulation. Wonder if you could affirm
the method I used and suggest possible extension.

Consider, you have few time-series - with var year [1970m01-2007m01]
(%tm) - and you want to plot a basic tsline (read twoway connected)
with markers. Because there are so many observations in the data set,
the plot doesn't look adequate. Since, short-term dynamics don't
matter too much I decided to take first month observation for each
year using:

-------------------------------------------
. tsset year
. gen tmp1 = string(year)
. gen tmp2 = real(tmp1)
. gen tmp3 = tmp2 if (int(tmp2/12)==tmp2/12)
. twoway (connected xxx year, msymbol(O)) if tmp3 !=.
. format tmp3 %tm
-------------------------------------------

It works alright but would it be the best way of doing it? Since it
clearly only works for the 1st month of each year, another question
begs to be answered - how would you perform the same task with
quarterly/half-year data points to increase precision?


Regards,
D.Cyril
*
*   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