Got it, thank you.
Do you know if there is any way to get macros to recognize large
integers as such and respond by storing them as long instead of float?
For this particular project I just replaced date_cohort with a Stata
date formated as %d. It's even easier on the human eye than the
YYYYMMDD format and it sorts properly.
Gabi
On 4/23/08, Austin Nichols <[email protected]> wrote:
> . di 20080421
> 20080421
>
> . di float(20080421)
> 20080420
>
> See
> help data_types
> and note that if date_cohort were double or long you would face no
> precision problem.
>
>
>
>
> On Wed, Apr 23, 2008 at 11:09 AM, Gabi Huiber <[email protected]> wrote:
> > I am having some trouble getting global macros to represent numbers properly.
> >
> > Every week I receive some csv files that are named things like file_20080331.csv
> >
> > I use these files in a series of do-files that reference them as
> > file_${t}.csv, and all is well.
> >
> > However, when at the very end I produce a rolling summary report file
> > where I want to record the date in the same format, I am getting a
> > surprise result. I am doing this:
> >
> > [...]
> > local lastline=${cycles}+1
> > set obs `lastline'
> > replace date_cohort=${t} in `lastline'
> > [...]
> >
> > Yet the date_cohort observation corresponding to ${t}=20080331 is
> > 20080332; and the one that corresponds to ${t}=20080421 is 20080420.
> >
> > It's strange, because if ${t} were anything but 20080421, my do-files
> > would produce a "file not found" error when trying to look for that
> > day's csv file. So I am sure that ${t} stores the correct value. What
> > I am not sure of is why it is rendering it with a day off in either
> > direction.
> >
> > Can anybody help?
> >
> > Thank you,
> >
> > Gabi
> > *
> *
> * 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/
>
*
* 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/