[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Arrays - unidentified number of elements
oscmd dir /b *.dta -
When I run the program - oscmd, no results appear in
the Results window. (If I type just dir /b *.dta, the
files are listed in the results window). A window
flashes for a second and disappears. The OS is
--- Nick Cox <email@example.com> wrote:
> Karina Fortuny
> > folder.
> > I can define an array:
> > local array "file1 file2 file3 .... fileN"
> > and loop through the elements.
> > But I do not want to type all the names (if there
> > 50 or so; it's possible to make typos, and it's
> > difficult to audit).
> > Is it possible to define the array without listing
> > elements if the number of elements is known? Is it
> > possible if the number is not known?
> > I'm currently using STATA 7, but might be
> upgrading to
> > STATA 8.
> Here there is
> 1. a general question about what I will call lists
> the term "arrays" doesn't have a fixed meaning in
> so far as I know; perhaps there is some sense
> over here from use of Some Alternative Software
> I don't know or use
> 2. a particular question about handling
> lists of files in a folder.
> 1. There are lots of tricks to handling lists,
> even in Stata 7. In Stata 8, there are even more.
> In either case, too many to list in an email.
> 2. Let me focus instead on files in a folder.
> What OS are you using? I guess Windows.
> Here is one idiosyncratic way to do this. I have
> a little program, which we may call "oscmd".
> program def oscmd
> version 7
> tempfile file
> ! `0' > `file'
> type `"`file'"'
> How does this work? At what Windows XP calls
> the command prompt I can go
> dir /b *.dta
> to get a bare list of *.dta files in the
> current directory. But don't fire that up: stay
> in Stata. Install -oscmd- and type in Stata
> oscmd dir /b *.dta
> and a list of filenames will appear
> in your results window. Now copy and paste
> to the do file editor.
> > "The soul unfolds itself like a lotus of countess
> > - Kahlil Gibran
> Shouldn't it be "countless"?
> * For searches and help try:
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
"The soul unfolds itself like a lotus of countless petals." - Kahlil Gibran
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
* For searches and help try: