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: -project- and disappearing data base
From
Robert Picard <[email protected]>
To
[email protected]
Subject
Re: st: -project- and disappearing data base
Date
Sat, 20 Jul 2013 23:11:38 -0400
You need to use the -preserve- option if you intend to continue using
the data after you issue a build directive. From the help file:
-preserve- indicates that the data in memory should be preserved and
restored after the build directive is processed. By default, the data
is cleared. This is more efficient, especially when dealing with
large datasets. In most cases, it will not matter; you place an
-original(filename)- or -uses(filename)- directive just before using
the file and a -creates(filename)- directive just after saving the
file.
So in the case you describe, use the following after saving the dataset:
project, creates("`pdir'/proc_data/siab_r_7508_v1_sample.dta") preserve
or just put the directive at the end of the do-file when you are done
with the data and you don't mind -project- clearing the memory.
Robert
On Sat, Jul 20, 2013 at 10:11 PM, Roberto Ferrer <[email protected]> wrote:
> User-written package -project- by Robert Picard and installed using:
> net from http://robertpicard.com/stata
>
> I'm having some trouble with the -project- commands. Specifically, It
> seems as if after executing -project, creates()- the data base gets
> wiped out. In the example I post below it happens at the end of the do
> file contained in the project. But it also occurs in any part of the
> file.
>
> Immediately below is my master file:
>
> version 12
>
> * Common settings
>
> set more off
> set varabbrev off // for long projects, it's best not to abbreviate
> set linesize 132 // use 7pt font for printing
>
> * Add a directory to the ado-path for programs that are local to this project
>
> adopath ++ "`c(pwd)'/ado"
> project, do("ado/link_ado_files.do")
>
> * Make sample data base to develop code (original data base is too large)
>
> project, do("do_files/make_sample.do")
>
>
>
> Now I post part of log file corresponding to the file -make_sample.do-
>
> . sample 50, count
> (34862727 observations deleted)
>
> . disp "`pdir'/proc_data/siab_r_7508_v1_sample.dta"
> /home/roberto/Dropbox/UCL/1_Dissertation/ucl_thesis_stata/proc_data/siab_r_7508_v1_sample.dta
>
> .
> . save "`pdir'/proc_data/siab_r_7508_v1_sample.dta", replace
> file /home/roberto/Dropbox/UCL/1_Dissertation/ucl_thesis_stata/proc_data/siab_r_7508_v1_sample.dta
> saved
>
> .
> . describe, short
>
> Contains data from
> /home/roberto/Dropbox/UCL/1_Dissertation/ucl_thesis_stata/proc_data/siab_r_7508_v1_sample.dta
> obs: 50 SIAB-Regionalfile v1,
> 1975-2008, 17 Oct 2011
> vars: 26 21 Jul 2013 02:45
> size: 2,050
> Sorted by:
>
> .
> . project, creates("`pdir'/proc_data/siab_r_7508_v1_sample.dta")
> project ucl_thesis_stata > do-file creates:
> "proc_data/siab_r_7508_v1_sample.dta" filesig(1402936768:65096)
>
> .
> . describe, short
>
> Contains data
> obs: 0
> vars: 0
> size: 0
> Sorted by:
>
>
> The data is there before the -project, creates()- and right after the
> command it disappears. What's going on?
>
> Any help is appreciated.
>
> 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/