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   "Dan Menes" <dan.menes@bateswhite.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: timestamps, GNU/make-style Stata program
Date   Wed, 15 Jun 2005 13:30:29 -0400

I've toyed with the idea of doing something similar.  It would be fairly easy to write a "C" plugin to do what you want, as the Stata plugin architecture provides a way to return a macro from within the C plugin (see www.stata.com/plugins/).


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Jeph Herrin
Sent: Wednesday, June 15, 2005 10:35 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: timestamps, GNU/make-style Stata program


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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index