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   Rebecca Pope <>
Subject   Re: st: FW: How to compare file structure difference before append
Date   Wed, 9 Jan 2013 13:19:24 -0600

-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
tostring price, replace
save autodemocopy.dta, replace
describe , replace clear
tempfile foobar
save `"`foobar'"'
describe, replace clear
merge 1:1 name type vallab varlab using `"`foobar'"'
list name type vallab varlab if _merge!=3
*** 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

(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.


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:
> *
> *
> *
*   For searches and help try:

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