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

st: timestamps, GNU/make-style Stata program


From   James Muller <[email protected]>
To   statalist <[email protected]>
Subject   st: timestamps, GNU/make-style Stata program
Date   Wed, 15 Jun 2005 13:41:12 +1000

Hello List,

I'm wishing to do something (described below), but am unsure of exactly how to implement it (question at bottom). Read on.

I'm wishing to implement something like GNU/make in a project I'm working on. That is, something that will compare file timestamps to see whether a dataset, for instance, needs to be rebuilt from a set of scripts. If the timestamp on the do files is more recent than that of the dataset it generates then the dataset should be regenerated. This is a very efficient way of resolving dependencies and such.

I've been looking hard and can't find anything within Stata that returns the timestamp of a file. The only way I can find to do this on a .dta file is by reading the file contents itself (there is a text-formatted timestamp in the header of the file). I can't find a way to check the timestamp of any other type of file.

There are two alternatives I can see:
1. Call the operating system to return the code, try to somehow capture the output.
2. Use the checksum function along with some other files that contain the last known checksum.

Assuming there isn't anything within Stata to do this, the operating system method is best, but I'm not sure how to capture the OS output - do something with environment variables, perhaps.

So here's what I ask:
1. Has anybody tried to do something similar before? If so, what was your experience?
2. Is there an internal Stata method to read the timestamp of a file? Version 8.2 preferable to version 9.0.
3. If not, does anybody have any experience with capturing operating system output to Stata?
4. Any comments, etc, at all?

Cheers in advance

James

*
* 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