Hi again--
Here is a solution to the problem I presented yesterday. I am sure it can be
improved upon, for example, by writing 2 ado files. But this solution does
work.
It turned out that when the -merge- command is being used, it only keeps the
notes from the master data set, but not from the -using- one. So, what I
have done is to store in local macros the -using- dataset notes before the
merge, and then to define new data notes after the merge:
--------------- Begin program code ----------
use tomerge, clear
// save data notes in local macros
local dta1_0 : char _dta[note0]
forval i = 1/`dta1_0' {
local dta1_`i' : char _dta[note`i']
}
use master, clear
merge id using tomerge
// attach data notes from local macros
forval i = 1/`dta1_0' {
note _dta : "`dta1_`i''"
}
sort id
save merged, replace
--------------- End program code ----------
Thanks,
--Estie Hudes
st: accumulating _dta notes
From "Hudes, Estie" <[email protected] <mailto:[email protected]>>
To "'Statalist'" <[email protected]
<mailto:[email protected]>>
Subject st: accumulating _dta notes
Date Mon, 12 Jan 2004 18:39:48 -0800
Dear Statalisters--
I am creating a large Stata dataset, using 6 individual temporary dataset
created on the way. The temporary datasets are all saved with _dta notes.
However, most of these get lost when I merge all the datasets together.
Do you know why this is happening, and how I can keep all the notes from the
individual datasets?
Thanks,
--Estie Hudes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Estie Sid Hudes, PhD, MPH
Specialist/Statistician
Center for AIDS Prevention Studies &
Department of Epidemiology & Biostatistics
University of California, San Francisco
74 New Montgomery St., Suite 600
San Francisco, CA 94105
phone: 415/597-9126
fax: 415/597-9194
email: [email protected]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* 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/>
*
* 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/