Roy Wada pointed to a more general, platform-independent method.
For the record, an analogue of
sh ls *.do > `dolog'
that works in (my flavour of) Windows XP is
sh dir /b *.do > `dolog'
Nick
[email protected]
Ulrich Kohler
I drafted two little programs -ldta- and -ldo- that provide a clickable
list of .dta files or .do files in the working directory.
Unfortunatelly, as they stand, the programs only work for Unix/Linux, as
I do not know how I can write a text-file with filenames into a file
under Windows (see program code below). I thought of
. log using x
. quietly dir *.dta
. log close
but obviously this doesn't help. I also thought of
sh dir *.dta > 11
but I cannot test it as I don't have access do Windows-machine with
Stata right now.
Any hints most appreciated.
Uli
---------------------------------------------------ldo.ado
*! version 0.1 Mai 14, 2009 @ 11:05:32 UK
*! Clickable list of .do files
program ldo
version 10.0
// Create file with File-list
tempname dolog
sh ls *.do > `dolog'
tempname dolist
// Open with file
file open `dolist' using `dolog', read text
local linenum = 0
file read `dolist' line
// Display filenames with clickable items
while r(eof)==0 {
local linenum = `linenum' + 1
display as text %5.0f `linenum' ///
as result `"{col 6} `macval(line)' "' ///
`"{right:[{stata `"view "`macval(line)'""':view}]{space 5}[{stata
`"doedit "`macval(line)'""':edit}]{space 5}[{stata `"do
"`macval(line)'""':do}]{space 5}[{stata `"erase
"`macval(line)'""':{err}erase}]}"'
file read `dolist' line
}
file close `dolist'
end
exit
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/