Statalist


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

AW: st: AW: compare files, vars only


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: AW: compare files, vars only
Date   Fri, 20 Feb 2009 15:00:01 +0100

<> 



Sorry about that! Let me check whether Nick has superseded all our
discussions yesterday with his new package...


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Jeph Herrin
Gesendet: Freitag, 20. Februar 2009 14:31
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: AW: compare files, vars only

If you look closely, my first posting of this was 15 minutes before
Samuel's. So perhaps you should redirect this thought to him...:)

cheers,
Jeph


Martin Weiss wrote:
> <>
> 
> Wow, this thing lingers on, but I think we have seen this variation 
> before...
> http://www.stata.com/statalist/archive/2009-02/msg00826.html
> 
> 
> HTH
> Martin
> _______________________
> ----- Original Message ----- From: "Jeph Herrin" <jeph.herrin@yale.edu>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Thursday, February 19, 2009 5:34 PM
> Subject: Re: st: AW: compare files, vars only
> 
> 
>> I think
>>
>>  loc diff : list first - second
>>
>> will only give the variables in the first file not in the
>> second, but ignores those in the second not in the first.
>>
>> how about:
>>
>> ************* compare variables ********
>> program define compvars
>> syntax using/
>> tempname file1 file2 equiv diff1 diff2
>> quietly d , varlist
>> local `file1'=r(varlist)
>> quietly d using `using', varlist
>> local `file2'=r(varlist)
>> local `equiv' : list `file1'===`file2'
>> if ``equiv''!=1 {
>> local `diff1' : list `file1'-`file2'
>> local `diff2' : list `file2'-`file1'
>> di "Difference: "
>> di "   In master not using:  "
>> di "                ``diff1''"
>> di "   In using not master:  "
>> di "                ``diff2''"
>> }
>> else {
>> di "Difference: "
>> di "   None!    "
>> }
>> end
>> ****************************************************
>>
>> Whence:
>>
>> . sysuse auto
>> . drop  gear_ratio displacement
>> . save newauto,replace
>> . sysuse auto
>> . compvars using newauto
>> Difference:
>>    In master not using:
>>                 displacement gear_ratio
>>    In using not master:
>>
>>
>> hth,
>> Jeph
>>
>>
>>
>> Johannes Geyer wrote:
>>> what about:
>>>
>>>  *************
>>>  clear*
>>>  sysuse auto, clear
>>>  drop  gear_ratio displacement
>>>  save newauto, replace
>>>  sysuse auto, clear
>>>  qui ds
>>>  loc first `r(varlist)'
>>>
>>>  des using auto, varlist
>>>
>>>  loc second `r(varlist)'
>>>  loc diff: list first - second
>>>  di in red "Differences: `diff'"
>>>  *************
>>>
>>> -describe- does not need to load the dataset which may be of interest 
>>> here
>>>
>>>
>>> Johannes
>>>
>>> owner-statalist@hsphsun2.harvard.edu schrieb am 19/02/2009 16:53:44:
>>>
>>>> <>
>>>>
>>>>
>>>>
>>>> *************
>>>> clear*
>>>> sysuse auto, clear
>>>> drop  gear_ratio displacement
>>>> save newauto, replace
>>>> sysuse auto, clear
>>>> qui ds
>>>> loc first `r(varlist)'
>>>> u newauto, clear
>>>> qui ds
>>>> loc second `r(varlist)'
>>>> loc diff: list first - second
>>>> di in red "Differences: `diff'"
>>>> *************
>>>>
>>>> I am sure I have violated several rules on the possible lengths of
>>>> components in here (think 244...)
>>>>
>>>>
>>>> HTH
>>>> Martin
>>>>
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: owner-statalist@hsphsun2.harvard.edu
>>>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von David
>>> Kantor
>>>> Gesendet: Donnerstag, 19. Februar 2009 16:41
>>>> An: Statalist
>>>> Betreff: st: compare files, vars only
>>>>
>>>> Hi.
>>>> Does anyone know of a program to compare the sets of variables in two
>>>> data files? What I have in mind is something akin to -cf-, but...
>>>>   it would not compare values -- only the names of variables;
>>>>   it would not care whether the two data files had the same number of
>>>> observations.
>>>>
>>>> I was planning to write such a program, but I wanted to be sure that
>>>> it hadn't already been done.
>>>> Thanks
>>>> --David
>>>>
>>>> *
>>>> *   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/
> 
*
*   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