Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Re: Populating a local macro


From   "Sherriff, Martyn" <martyn.sherriff@kcl.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: Populating a local macro
Date   Tue, 12 Oct 2010 21:12:49 +0100

Nick,
	As always - thanks for your help. I must improve my Stata search techniques.
Martyn

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Tuesday, October 12, 2010 2:57 PM
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: RE: Re: Populating a local macro

See -help extended_fcn-. Alternatively, look at -fs- from SSC. There are yet more alternatives. 

Nick 
n.j.cox@durham.ac.uk 

Sherriff, Martyn

I have some data that is created by a test machine which generates 5 datafiles within a directory. Typically there are 20+ directories. If I put these directory names into the local macro name then I can read all the data as follows with this do file fragment:

local name ""Damon_mx 16x22 3M_1.is_comp_RawData" "Damon_mx 16x22 ormco.is_comp_RawData" "Damon_mx 16x22 tp_1.is_comp_RawData" .......

and then do the necessary data processing.

My problem is that I have to create the local by hand and it changes with each experiment - and the name structure can lead to (my) data entry errors.
 I can get a list of the relevant directory names using:

! dir /ad /b >dirlist.txt
. file open myfile using dirlist.txt, read

Is there a way of getting this directory list into the local macro name? I am using Stata 11.


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

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index