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

st: new jokes

From   baum <[email protected]>
To   StataList <[email protected]>
Subject   st: new jokes
Date   Fri, 16 Aug 2002 14:05:59 -0400

Well, the new, improved tsspell is so handy, it will force me to retire my Harry Potter jokes about the older -spell- routine. Instead we can turn to Florida elections jokes (were that they were). Absent from the otherwise copious help in tsspell is an example of how a macroeconomist may detect recessions (using a crude form of the NBER's recession-dating methodology). Whatever your political leanings (or if you are merely an amused observer of these shenanigans from afar), tsspell makes it very easy indeed to perform these calculations:


g str3 party = "Rep" if tin(,1960q4) | tin(1969q1,1976q4) /*
*/ | tin(1981q1,1992q4) | tin(2001q1,)
replace party = "Dem" if party==""

* define a recession as two quarters' decline in real GDP
g sign = sign(D.realGDP)
tsspell sign
egen qtrs = max(_seq), by(_spell)
gen recession = (D.realGDP<0 & qtrs>=2)

list yq realGDP qtrs party if recession

* what were the longest expansions, and who was in charge
* when they ended?

gsort -qtrs
keep if _end & sign
list qtrs party yq in 1/5

If we had a multi-country panel data set of GDP figures for, say, the G7, the logic above would work just as well; as tsspell's help indicates, one would merely modify the egen to include the 'iis' variable.


* For searches and help try:

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