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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: comparing datasets


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: comparing datasets
Date   Mon, 8 Aug 2011 16:10:50 +0100

In practice, this recommendation is likely to bite because of the limits on length of string returned as the result of an evaluation. The equals sign forces an evaluation and will as a side-effect truncate strings to 244 characters.

One of several alternatives:

<read in first dataset>
unab first: *
<read in second dataset>
unab second: *

and then look at the difference between the two macros.

Nick

On 8 Aug 2011, at 15:45, Mauro Mastrogiacomo <M.Mastrogiacomo@cpb.nl> wrote:

Hi, one way could be

des, varlist
local myvars=r(varlist)
dis "`myvars'"

if you repeat this also for the second dataset then you can subtract the two macro's and the difference is what you need.
mauro



-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
statalist@hsphsun2.harvard.edu] On Behalf Of Abhimanyu Arora
Sent: maandag 8 augustus 2011 16:32
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: comparing datasets

As a follow up, there should be something in the macros in r(), but
return list gives me a blank stare.
Abhimanyu

On Mon, Aug 8, 2011 at 4:27 PM, Abhimanyu Arora
<abhimanyu.arora1987@gmail.com> wrote:
Dear statalist
Hope all's well
I have two datasets, one of which has all the variables of the
second,
plus additional variables. I would like to get a list of all these
additional variables. There's this obscure command -dta_equal- that I have got hold of, but contrary to what's in the help file, it doesn't
display the unique variables belonging to a particular dataset,
rather
seems to be working merely like the -cf-. Any
alternative/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index