Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: FW: How to compare file structure difference before append

From   Nick Cox <>
Subject   Re: st: FW: How to compare file structure difference before append
Date   Wed, 9 Jan 2013 22:12:54 +0000

You may be right. I was trying to answer the question that was asked,
which often is wrong. But I think it usually takes a human to see that
the same name is being applied to different things, or the same thing
being named differently in different datasets.

I had completely forgotten that I wrote -cfvars-, but Rasool's post
just said "user-written". Now that it is mentioned, I can add that
Rasool is correct. -cfvars- does only what it is intended to do.


On Wed, Jan 9, 2013 at 7:19 PM, Rebecca Pope <> wrote:
> -describe using- requires the user to spot the differences between the
> current data and the listed output, correct? Maybe I'm reading too
> much into the question but I thought Rasool was looking for a way have
> Stata do the comparing. That's just my inference based off of the
> reference to -cfvars-(1).
> -describe using- gave me an idea for a different approach though.
> Here's a modification to what I posted earlier.
> *** begin ***
> sysuse auto.dta, clear
> preserve
> tostring price, replace
> save autodemocopy.dta, replace
> describe , replace clear
> tempfile foobar
> save `"`foobar'"'
> restore
> preserve
> describe, replace clear
> merge 1:1 name type vallab varlab using `"`foobar'"'
> list name type vallab varlab if _merge!=3
> restore
> *** end ***
> This checks format and labels. It could be modified to any attribute
> that -describe- assesses. The -merge- can also be changed to keep only
> records that conflict. I've left it like this so all original
> variables still show up in "name" if the user wants to look at
> everything.
> (1) Nicholas J. Cox, 2009. "CFVARS: Stata module to compare variable
> name lists in two data sets," Statistical Software Components S457004,
> Boston College Department of Economics.
> Rebecca
> On Wed, Jan 9, 2013 at 11:46 AM, Nick Cox <> wrote:

>> On 21 December I suggested -describe using-.
>> Nick
>> On Wed, Jan 9, 2013 at 12:50 PM, rasool.bux <> wrote:
>>> I have seen user written program -cfvars- but it is just comparing variable names. Any suggestions.
>>  -----Original Message-----
>>> From: rasool.bux
>>> Sent: Friday, December 21, 2012 11:17 AM
>>> To: ''
>>> Subject: how to know the file structure difference before append
>>> Is there any way to compare the dta file structure of two files to see the differences in varnames, types and formats?
>>> Then I want to use the append to combine the observations of both files.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index