Statalist


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

AW: AW: st: AW: compare files, vars only


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: AW: st: AW: compare files, vars only
Date   Thu, 19 Feb 2009 18:03:36 +0100

<> 

" Incidentally, the "blue" output is written in green to my screen. I use
Windows."

Well, Stata never promised to -display- in blue, did it? [P] display
enumerates the colors on the standard background. If one really wanted blue,
one would have to right-click the results window and change stuff on the
"Results color" tab...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Friedrich
Huebler
Gesendet: Donnerstag, 19. Februar 2009 17:56
An: [email protected]
Betreff: Re: AW: st: AW: compare files, vars only

Steve's example can be made more instructive by adding a -drop-
command after -sysuse auto, clear-.

clear*
sysuse auto, clear
drop  gear_ratio displacement
save newauto, replace
sysuse auto, clear
drop mpg
qui ds
loc first `r(varlist)'
des using newauto, varlist
loc second `r(varlist)'
loc diff12 : list first - second
loc diff21 : list second - first
di in red "In 1st, not 2nd:  `diff12'"
di in blue "In 2nd, not 1st:  `diff21'"

The last two lines return this output:

In 1st, not 2nd:  displacement gear_ratio
In 2nd, not 1st:  mpg

Incidentally, the "blue" output is written in green to my screen. I use
Windows.

Friedrich

On Thu, Feb 19, 2009 at 11:49 AM, Steven Samuels
<[email protected]> wrote:
>
> It's easy enough to fix Johanne's code to bypass the the size difference
> problem:
>
> -Steve
>
> *************
>  clear*
>  sysuse auto, clear
>  drop  gear_ratio displacement
>  save newauto, replace
>  sysuse auto, clear
>  qui ds
>  loc first `r(varlist)'
>
>  des using newauto, varlist
>
>  loc second `r(varlist)'
>  loc diff12 : list first - second
>  loc diff21 : list second - first
>  di in red "In 1st, not 2nd:  `diff12'"
>  di in blue "In 2nd, not 1st:  `diff21'"
>
>  *************
>
> On Feb 19, 2009, at 11:31 AM, Martin Weiss wrote:
>
>>
>> <>
>>
>> You probably meant
>>
>>
>> *************
>> des using newauto, varlist
>> *************
>>
>> right in the middle of your code. My knee-jerk proposal depends on the
>> first
>> dataset being larger than the second one, BTW...
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Johannes
>> Geyer
>> Gesendet: Donnerstag, 19. Februar 2009 17:25
>> An: [email protected]
>> Betreff: Re: st: AW: compare files, vars only
>>
>> 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
>>
>> [email protected] 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: [email protected]
>>> [mailto:[email protected]] 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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index