***********
sysuse auto, clear
drop mpg for gear
save mynewauto1, replace
sysuse auto, clear
drop mpg
save mynewauto2, replace
d using "C:\Users\ma\Documents\Stata\mynewauto1.dta", varl
local first `r(varlist)'
d using "C:\Users\ma\Documents\Stata\mynewauto2.dta", varl
loc second `r(varlist)'
loc diff: list second - first
loc joint: list second & first
di in red "Differences: `diff'"
di in red "Common: `joint'"
***********
HTH
Martin
_______________________
----- Original Message -----
From: "Xu, Haiyong" <[email protected]>
To: <[email protected]>
Sent: Friday, November 07, 2008 12:42 AM
Subject: st: compare two datasets (variable name only)
Hi,
Is there any way to compare only the variable names in two datasets? What
I want to know is what variables are in common and what variables only
exist in one of the two datasets.
Thanks.
Haiyong
IMPORTANT WARNING: This email (and any attachments) is only intended for
the use of the person or entity to which it is addressed, and may contain
information that is privileged and confidential. You, the recipient, are
obligated to maintain it in a safe, secure and confidential manner.
Unauthorized redisclosure or failure to maintain confidentiality may
subject you to federal and state penalties. If you are not the intended
recipient, please immediately notify us by return email, and delete this
message from your computer.
*
* 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/