Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Why does Stata run my do-file every time when I use a makefile?
From
Ricardo Altamirano <[email protected]>
To
[email protected]
Subject
st: Why does Stata run my do-file every time when I use a makefile?
Date
Fri, 1 Mar 2013 19:47:59 -0600
I posted a similar thread before, but I narrowed the problem down to a
simple example that I hope will help solve it. I'm using a makefile to
run several Stata files that work with text files, other datasets,
etc. Every time I run make, it runs `analysis.do`, even if I make no
changes to any of the dependencies.
Here is the makefile:
.PHONY: clean spotless
STATACOMMAND=/opt/stata/stata-mp -b
analysis.txt: analysis.do uniform.dta normal.dta
$(STATACOMMAND) analysis.do
uniform.dta: uniform.do
$(STATACOMMAND) uniform.do
normal.dta: normal.do noise.txt
$(STATACOMMAND) normal.do
clean:
-rm *.log
spotless: clean
-rm analysis.txt
-rm *.dta
analysis.do
use normal.dta, clear
merge t using uniform.dta
log using analysis.txt, text
regress norm unif
log close
normal.do
clear
insheet using "noise.txt", clear
gen t = _n
gen norm = rnormal()
sort t
save normal.dta, replace
uniform.do
clear
set obs 10
gen t = _n
gen unif = runiform()
sort t
save uniform.dta, replace
noise.txt
noise
14
49
59
63
55
13
60
54
26
39
My actual code has a lot more files that exhibit this problem, but I'm
hoping this simple example will at least help me narrow it down.
Thank you for the help,
Ricardo Altamirano
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/