Saturday, February 18, 2006
st: running do files from unix -- can we pass values to the do file?
I want to run several time-intensive Stata jobs in the background at the same time (I can do it, because I can send them to different machines). The different jobs are exactly the same, but for a couple of locals at the beginning that vary in their values. One way to do this is to make as many copies of the do file as jobs, changing the values of the locals in each and renaming the do files, and then run them from Unix one by one, using their individual names. This is inelegant and, when you have to do it many many many times, rather bothersome.
An elegant and efficient alternative would be to be able to pass the values of the locals to the do file when running it, something like:
stata -b do dofile localvalue1 localvalue2 &
Of course, this cannot be done this way.
For the time being I have solved the problem with the help of a friend who wrote a pearl script that does exactly what I need . But I would like to know whether it can be done using just Stata -- not only I hate to use other programs if it can be done in Stata, but I like to be able to tinker with any program I use, something I cannot do with the pearl script because I don't know pearl.
-- Pablo A. Mitnik University of Wisconsin-Madison (http://www.wisc.edu/ ) Department of Sociology ( http://www.ssc.wisc.edu/soc/) Center on Wisconsin Strategy (http://www.cows.org/ ) 1180 Observatory Drive Room 7114A Madison, WI 53706 TEL (608) 2621839 E-mail: firstname.lastname@example.org
* * 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/
Links to this post: