[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: Re: Running a foreach loop over a sequence of dates |

Date |
Wed, 3 Dec 2008 22:34:09 +0100 |

HTH Martin _______________________

To: <statalist@hsphsun2.harvard.edu> Sent: Wednesday, December 03, 2008 10:29 PM Subject: Re: st: Re: Running a foreach loop over a sequence of dates

Ah, so true -- but by labeling it as "pseudo-code", Augusto indicatedthat he already knew that. Nonetheless, looping over dates would be*extremely* high on my list of wishes & grumbles! Perhaps in Stata11.... or even 10.2. (Since, in the end, dates are just formattednumbers, this seems as if it should be possible in theory.) There areapplications in which something much more light-weight than - rolling-would be appropriate. Although I agree that the example below couldlikely be accomplished with -rolling-.-- Mike On Dec 3, 2008, at 4:05 PM, Martin Weiss wrote:You cannot simply abbreviate your list of end dates like a - numlist-with a slash and hope for Stata`s acquiescence... I would recommend youlook at -h rolling-HTH Martin _______________________----- Original Message ----- From: "Augusto Cadenas"<aug.cadenas@googlemail.com>To: <statalist@hsphsun2.harvard.edu> Sent: Wednesday, December 03, 2008 10:02 PM Subject: st: Running a foreach loop over a sequence of datesHello, I am trying to run a series of commands in a time series setting, and interested in using variable time intervals (variable time windows, or variable start/end dates). So ideally, I would like to loop with -foreach- over a series of dates, but I cannot find the way of doing this. To give you an idea of the kind of problem, here it is in pseudo-code (not working): *** begin pseudo-code foreach t in 1992q1/2000q4 { reg y L.y L.x if tin(1960q1, `t') reg y L.y L.x if tin(`=`t'-20', `t') } *** end pseudo-code I am sorry if this is a trivial question, but I really could not find a way of performing this. Thanks for any hints. AC * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/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/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Re: Running a foreach loop over a sequence of dates***From:*"Augusto Cadenas" <aug.cadenas@googlemail.com>

**References**:**st: Running a foreach loop over a sequence of dates***From:*"Augusto Cadenas" <aug.cadenas@googlemail.com>

**st: Re: Running a foreach loop over a sequence of dates***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: st: Re: Running a foreach loop over a sequence of dates***From:*Michael Hanson <mshanson@mac.com>

- Prev by Date:
**Re: st: Video from multiple graph exports** - Next by Date:
**Re: st: Re: Running a foreach loop over a sequence of dates** - Previous by thread:
**Re: st: Re: Running a foreach loop over a sequence of dates** - Next by thread:
**Re: st: Re: Running a foreach loop over a sequence of dates** - Index(es):

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