Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Re: Comparing datasets


From   "Rajesh Tharyan" <R.Tharyan@exeter.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Re: Comparing datasets
Date   Wed, 17 Sep 2008 02:07:35 +0100

Hi,
Put version 9 on top of eva's program and run it. It will work
rajesh

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael McCulloch
Sent: 17 September 2008 01:13
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Re: Comparing datasets

This looks very useful. If I run the example and neither dropped 
variable are reported by the program, what does that mean? I'm using 
v9.2.

>If you use -cf- you have to use it in both directions, to be on the
>safe side. However, -cf- compares all values as well, which will
>clutter the output considerably if these are actually two different
>datasets with the same variable names.
>
>Here is a way to avoid this problem. The example uses the auto data.
>
>****
>sysuse auto, clear
>drop foreign
>save myauto1
>sysuse auto, clear
>drop price head
>save myauto2
>
>qui ds
>local second `r(varlist)'
>
>use myauto1, clear
>qui ds
>local first `r(varlist)'
>
>foreach x of local first {
>  if strpos("`second'","`x'") == 0 {
>    di in yellow "`x' is not present in the second file."
>  }
>}
>
>foreach x of local second {
>  if strpos("`first'","`x'") == 0 {
>    di in yello "`x' is not present in the first file."
>  }
>}
>
>erase myauto1.dta
>erase myauto2.dta
>************************
>
>Eva
>
>2008/9/15 Martin Weiss <mw.stlist@googlemail.com>:
>  > -h cf-
>  >
>>  Martin Weiss
>>  _______________________
>>  ----- Original Message ----- From: "Raphael Fraser"
>>  <raphael.fraser@gmail.com>
>>  To: <statalist@hsphsun2.harvard.edu>
>>  Sent: Monday, September 15, 2008 10:42 PM
>>  Subject: st: Comparing datasets
>>
>>
>>>  I have 300 variables in one dataset, 298 in another dataset. Both
>>>  datasets should have the same variable names. How can I identify which
>>>  variables do not match up?
>>>
>>>  Raphael
>>>  *
>>>  *   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/
>>
>*
>*   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/

*
*   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   |   What's new   |   Site index