Bookmark and Share

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


[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 <[email protected]>
To   [email protected]
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
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.
http://ideas.repec.org/c/boc/bocode/s457004.html

Rebecca

On Wed, Jan 9, 2013 at 11:46 AM, Nick Cox <[email protected]> wrote:
> On 21 December I suggested -describe using-.
>
> http://www.stata.com/statalist/archive/2012-12/msg00790.html
>
> Nick
>
> On Wed, Jan 9, 2013 at 12:50 PM, rasool.bux <[email protected]> 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: '[email protected]'
>> 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:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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