Bookmark and Share

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]

Re: st: -build_directives- and -project- command


From   Robert Picard <[email protected]>
To   [email protected]
Subject   Re: st: -build_directives- and -project- command
Date   Sat, 20 Jul 2013 12:11:18 -0400

Actually, the build directives do not load any file, they are just
there to record the dependencies within -project-. There are many ways
that a do-file can depend on a dataset that do not involve the -use-
command. Let's say that you have two datasets that were created
(saved) upstream in different do-files and now you want to merge them:

project, uses("prices.dta")
project, uses("cpi.dta")
use "prices.dta"
merge m:1 year using "cpi.dta"
[... do some stuff]
save "prices_cpi.dta"
project, creates("prices_cpi.dta")

In terms of dependencies, "cpi.dta" is used by the do-file even though
it is loaded from a -merge- command. Note that the above code will
produce an error if there are no prior -project,
creates("prices.dta")- and -project, creates("cpi.dta")- in the
do-files that created them. If you found these files on a web site
instead, then you would use instead:

project, original("prices.dta")
project, original("cpi.dta")
use "prices.dta"
merge m:1 year using "cpi.dta"

The different types of dependency are used to check the logic of what
you are doing. You cannot create a file that is already in the
project. You cannot state that a file is an original if it has already
been created upstream. You cannot use a file (in the sense of
-project, uses()-) unless it was created in the project.

Hope this helps,

Robert



On Sat, Jul 20, 2013 at 10:12 AM, Roberto Ferrer <[email protected]> wrote:
> Regarding the user-written package -project- by Robert Picard and
> installed using:
>
>  net from http://robertpicard.com/stata
>
> I'd just like to comment and get some feedback on:
> In terms of the -build_directives- commands, in the help file I think
> it would be a good idea to state that -uses- actually loads the
> specified file. This is in contrast to -original-, for example, that
> must be specified along with a default Stata command such as -use-:
>
>     project, original("`pdir'/data/stata/college.dta")
>     use "`pdir'/data/stata/college.dta"
>
> The reason for being explicit is simply the definiton of
> -build_directives- given in -help-: "Your include build directives in
> do-files to INDICATE each do-file's dependencies". (My capitals.
> "Your" must be a typo and should read "You".) Furthermore, it would be
> nice to have something like:
>
> project, uses(file_name) [original, created]
>
> that substitutes both -original- and -uses-, loading the data AND
> flagging the dependency. Don't know how difficult this actually is or
> if it even makes sense.
>
> Thanks.
>
> Roberto
> Stata 12.1 (64-bit)
> Linux Mint Debian Edition (LMDE)
> *
> *   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index