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
Abhimanyu Arora <[email protected]>
To
[email protected]
Subject
Re: st: comparing datasets
Date
Mon, 8 Aug 2011 17:37:41 +0200
Dear Maarten
Thanks for the clarifying example.
Dear Nick
Thanks for the timely intervention. If I may ask, what does the
asterisk mean in the line -unab first: *-?
-di `first'- actually doesn't give the list of the
variables....instead giving a string of values taken up by the first
observation.
Best regards
Abhimanyu
On Mon, Aug 8, 2011 at 5:15 PM, Maarten Buis <[email protected]> wrote:
> --- 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/
>
*
* 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/