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, is already up and running.

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

st: Makefiles that uses do files to build data sets runs several do files every time?

From   Ricardo Altamirano <>
Subject   st: Makefiles that uses do files to build data sets runs several do files every time?
Date   Mon, 18 Feb 2013 11:39:33 -0600

Dear Statalist,

I'm using a makefile to run a group of Stata files that process raw
datasets stored in several directories and merge them into a single
data set. Each time I run the makefile, it builds the majority of the
files (specifically, it runs through, even if I run
make back to back without making any changes. Is there an error in my
makefile, or am I misunderstanding how to use a makefile with Stata
(which very well could be the case)?

These are the contents of the makefile:

        .PHONY: clean

	STATACOMMAND=/usr/local/stata/stata-mp -b

	# Main target
	analysis.txt: dta/finaldata.dta
	    mv *.log logs/

	dta/finaldata.dta: dta/raw8.dta dta/raw9.dta dta/raw10b.dta

	dta/raw10b.dta: dta/raw10a.dta ;

	dta/raw10a.dta: raw10datasource/%.txt

	raw10datasource/%.txt: ;

	dta/raw9.dta: raw9datasource/raw9.dct raw9datasource/raw9.txt

	raw9datasource/raw9.dct raw9datasource/raw9.txt: ;

	dta/raw8.dta: dta/raw7.dta dta/raw5.dta:

	dta/raw7.dta: dta/raw6.dta

	dta/raw6.dta: raw6datasource/%.xls

	raw6datasource/%.xls: ;

	dta/raw5.dta: dta/raw4b.dta dta/raw3.dta

	dta/raw4a.dta dta/raw4b.dta: raw4datasource/ftp/%.csv

	raw4datasource/ftp/%.csv: ;

	dta/raw3.dta: raw3datasource/ftp/raw3.txt raw3datasource/ftp/raw3.dct

	raw3datasource/ftp/raw3.dct: ;
	raw3datasource/ftp/raw3.txt: ;

	dta/raw2.dta: dta/raw1.dta

	dta/raw1.dta: raw1datasource/%.txt

	raw1datasource/%.txt: ;

	    -rm *.log

Thank you,

Ricardo A.
*   For searches and help try:

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