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 on April 23, 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   Abhimanyu Arora <abhimanyu.arora1987@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <maartenlbuis@gmail.com> 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/


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