Statalist


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

Re: st: RE: RE: date function error?


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: date function error?
Date   Thu, 12 Jun 2008 22:25:55 -0400

Interestingly, I recently had a very similar problem.
I have a log-generating program -- an ado. It's not done automatically; it's called as needed, and it creates a log and runs a specified do-file.
I was running a do-file that included a date-conversion step. It ran fine in test runs. Then when I did the "official" run, in conjunction with with the logging program, it produced all missing values for the date conversion.
I took a while to figure out the problem. Actually, it took a while to figure out what conditions created missing values and non-missing values. Eventually, I found that it was the use of the logging program that made the difference. Until recently, it was always the case that the only difference between running with and without the logging program was the presence of logging. To me, this was a well-established "fact" that I had taken for granted. But it was no longer true once I (recently) switched to Stata 10.

The cause of the problem was that the do-file uses the -date()- function, as in...
gen long datevar = date(date_string_variable, "YMD")
and the logging program has -version 8-, as all my ado files have -version- commands. The do-file did not have a -version- command. It was written for Stata 10, but I didn't realize that the logging program would change the version for the do-file that runs under it -- to version to 8, wherein "YMD" was not acceptable.

I have it straightened out now, but I thought it was instructive to have gone through that experience -- and may be instructive to share it with the rest of you.

--David

At 02:37 PM 6/12/2008, George Hoffman wrote:

Thank you, Nick.
well, then the problem is somewhere else. my real question is about a
automatic log-creation program that i have run from a profile.do file at
stata startup, which has been malfunctioning.
[...]
*
*   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