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

Re: st: timestamps, GNU/make-style Stata program


From   Roger Harbord <[email protected]>
To   [email protected]
Subject   Re: st: timestamps, GNU/make-style Stata program
Date   Wed, 15 Jun 2005 16:22:38 +0100

Sounds interesting to me too. As an alternative approach, have you considered using the GNU or Un*x "make" command and calling Stata in batch-mode to execute do-files from within the makefile? Maybe a make command within Stata would be nice but using existing commands is surely going to be quicker to develop.. "make" is quite a sophisticated command and replicating all its functionality is going to take quite a bit of programming i would have thought.

If you're using Windows then there appear to be possibilities such as MinGW (Minimalist GNU for Windows) <http://sourceforge.net/project/showfiles.php?group_id=2435> which includes a "make" command: <http://sourceforge.net/project/shownotes.php?release_id=158854>
Haven't used this myself but I used to use Un*x and "make" is something I missed when I started using Stata under Windows and you've reminded me of that. If I had it i'd certainly use it rather than my present practice of writing "master" do-files in which I (try to) document file dependencies but have to select and "do" the appropriate bits by hand after I change something.

Good luck James - let us know how you get on, whichever way you choose to proceed.

Roger.

--On 15 June 2005 10:35 -0400 Jeph Herrin <[email protected]> wrote:


James,

Interesting question. Seems like the easiest way would be
to capture the output of -ls- and parse the timestamp out
of that. It is not exceedingly efficient but I think it would
be platform independent.

cheers,
Jeph


James Muller wrote:
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/


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



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