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

st: reading files of certain date.

From   Jens Lauritsen <>
Subject   st: reading files of certain date.
Date   Sat, 02 Apr 2005 19:34:29 +0200

I would (in windows) something along these lines:
cd ....../foldername // where your files are

* get the list as suggested yesterday into a file
!erase files.txt
dir parcel.* > files.txt

* then you read the file into stata one variable only having each line:
infix str80 line using files.txt

* then you convert each line into variables for day month and year
* (some minor changes to the syntax probably needed)
generate m = real(substr(line,index(line,"/")-2,1)
generate d = real(substr(line,index(line,"/")+1,1)
generate y = real(substr(line,index(line,"/")+4,1)

* and by combining you get the date of files solved.
generate day = dmy(d,m,y)

keep if day = d(.........) //e.g. d(29mar2005)
... and then some lines to get out only the lines you want.

you could do a small menu system in which you would only enter the date of interest and let the other things depend on that. There are good examples in the manuals. Otherwise enter the date of interest in that one line of the do file.

regards Jens Lauritsen

* For searches and help try:

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