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: comparing datasets
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: comparing datasets
Date
Mon, 8 Aug 2011 17:15:47 +0200
--- On Mon, Aug 8, 2011 at 4:45 PM, Mauro Mastrogiacomo wrote:
>> 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.
--- On Mon, Aug 8, 2011 at 5:02 PM, Abhimanyu Arora wrote:
> I see, Mauro, thanks, that's an ingenious way, but could you please
> elaborate on "differencing two macros"?
You need to look for extended macro functions, in particular the
facilities for handling lists. You can find the help files by Typing
in Stata -help macro-, and click on the link extended macro functions.
*------------- begin example ---------------
// file one
sysuse auto, clear
ds
local file1 "`r(varlist)'"
// file 2
drop mpg turn
ds
local file2 "`r(varlist)'"
// difference
local diff : list file1 - file2
di "`diff'"
*------------ end example ----------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/