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

Re: st: RE: RE: Access datasets created by date


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Access datasets created by date
Date   Fri, 01 Apr 2005 17:44:01 +0100

You could start by using the -shell- command in Stata to call a DOS DIR command and route the output to a file, as in

shell "dir /-d > trash1.txt"

and then read -trash1.txt- into a Stata string variable using my -intext- command, downloadable from SSC. You can then use existing Stata facilities, such as the official Stata -split- command and the -strdate- utility (downloadable from SSC), to do further processing within Stata.

I hope this helps.

Roger


At 16:51 01/04/2005, Mitra Pinaki wrote:

Nick,

    I'm using Windows 2000. Can something be done before exploring to
scripting language?

Thanks,
Pinaki

-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: Friday, April 01, 2005 10:17 AM
To: [email protected]
Subject: st: RE: Access datasets created by date

I don't know an easy way to do this
from within Stata.

The details depending on what OS you are using, you could route
the results of a -dir- or -ls- to a file and process that.

It may well be easier to you to write a script in your favourite
scripting language (Perl, Python, Awk, whatever) to ensure that
files are renamed so that the names show dates more transparently,
and then to read into Stata files satisfying a given pattern.
Naturally, your set-up may prohibit that.

Alternatively, you could write something to
work out the difference between the files
there now and last time you looked.

Nick
[email protected]

MITRA PINAKI

>     I have a list of text files in a folder which becomes available
> daily. I would like to access these daily files by date in my program.
> Is it possible in stata to identify the datasets created by date? My
> dataset are named like the following:
>
> Name                          Date Modified
> PARCEL.G1911V00               03/29/05
> PARCEL.G1921V00               03/29/05
> PARCEL.G1914V00               03/30/05
> and so on.
>
> In my program, I would only like to capture PARCEL.G1911V00 and
> PARCEL.G1921V00 since they are created on the same date (03/29/05) and
> ignore PARCEL.G1914V00 which I would like to capture on
> 03/30/05's run.

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

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

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