Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: notes lost in append


From   Fred Wolfe <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: notes lost in append
Date   Sat, 08 May 2004 13:25:39 -0500

I think there is a possible work-around. As notes are stored as -var[note(n)]:-, one could pull off the notes from each data set prio to the append/merge, compare them and then merge them into the master set according to some rule. I could see how this might be useful.

Fred

At 12:45 PM 5/8/2004, you wrote:

What kind of work-around are you expecting?

Stata's problem, I think, is that it expects at most one
note for each combination of name and number, e.g. "mpg"
and "1".

In addition, as the variables in the datasets typically
have the same names -- little point in -append-ing
otherwise -- it is difficult to think of a work-around
other than having unique variable names in each dataset,
to each of which you attach -notes-. I haven't tested that.

A clumsier alternative is to store text in a string
variable in each dataset.

Devra Golbe

> I would like to append two data files each having notes.  As
> the output
> below indicates,  notes from the "using" file are evidently
> not retained
> when the master file already contains notes on the same
> variable.  The same
> is true for a note attached to the file as a whole:  while it
> is possible
> to have multiple notes, if the master file contains such
> notes, none are
> retained from the using file.
>
> Does anyone know of a work-around?
>
> Thanks,
> Devra
>
> --------------------------------------------------------------
> -----------
> . use "C:\Stata8\auto.dta"
> (1978 Automobile Data)
>
> . keep if foreign==0
> (22 observations deleted)
>
> . notes
> . note: these are the domestic obs
> . note make: TS created in Domestic file
> . note price: TS created in Domestic file
> . save autoD, replace
> file autoD.dta saved
>
> . notes
>
> _dta:
>    1.  these are the domestic obs
> make:
>    1.  7 May 2004 16:19 created in Domestic file
> price:
>    1.  7 May 2004 16:19 created in Domestic file
> . clear
>
> . use "C:\Stata8\auto.dta"
> (1978 Automobile Data)
>
> . keep if foreign==1
> (52 observations deleted)
>
> . notes
>
> . note: these are the foreign obs
> . note: this is a second note attached to the foreign file
> . note make: TS created in Foreign file
> . note make: this is a 2nd note attached to make in the Foreign file
> . note mpg: TS created in foreign file
>
> . save autoF, replace
> file autoF.dta saved
>
> . notes
> _dta:
>    1.  these are the foreign obs
>    2.  this is a second note attached to the foreign file
> make:
>    1.  7 May 2004 16:19 created in Foreign file
>    2.  this is a 2nd note attached to make in the Foreign file
> mpg:
>    1.  7 May 2004 16:19 created in foreign file
>
> . append using "D:\Documents and Settings\Devra\My
> Documents\TEMP\autoD.dta"
> (label origin already defined)
>
> . notes
> _dta:
>    1.  these are the foreign obs
>    2.  this is a second note attached to the foreign file
> make:
>    1.  7 May 2004 16:19 created in Foreign file
>    2.  this is a 2nd note attached to make in the Foreign file
> price:
>    1.  7 May 2004 16:19 created in Domestic file
> mpg:
>    1.  7 May 2004 16:19 created in foreign file

*
*   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/

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761
fwolfe@arthritis-research.org


*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index