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   "rasool.bux" <>
To   "" <>
Subject   RE: st: FW: How to compare file structure difference before append
Date   Thu, 10 Jan 2013 07:46:45 +0000

Thanks for reply and help. As per my experience in other softwares sometime the variable name is same but the type is different i.e. number or string, by appending that column comes blank if type is not matched.

My intentions is to see the list of differences in the file structure as below.
1. # of variables matched and not matched in both files  (As -sfvars- doing)
2. list the type differences of matched variable names.
        Variable        type/format in master           type/format in using

So that we can look the values in both files and make the same before appending them.

Rasool Bux

-----Original Message-----
From: [] On Behalf Of Nick Cox
Sent: Thursday, January 10, 2013 3:13 AM
Subject: Re: st: FW: How to compare file structure difference before append

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:


This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.

*   For searches and help try:

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