Date: Wed, 24 Sep 2008 16:35:58 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>"
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>"
Subject: Re: Compare variables in two data sets
On Wed, 24 Sep 2008 11:25:53 -0500, ./ ADD NAME=Data _null_,
>The "others" will show you how to do this using dictionary.columns,
>comparing the variable names with a merge(join) to return the names
>that don't come from both places.
>However, you may find this method using PROC COMPARE amusing.
>data class1(drop=weight) class2(drop=height);
> set sashelp.class;
>proc compare base=class1(obs=0) compare=class2(obs=0) listvar brief;
>On 9/24/08, Peter Flom <email@example.com> wrote:
>> Hi again all
>> I have two data sets, each with many variables .... most of the variables
are in both data sets.
>> Is there a way to make a list of variables that are in only ONE of the
>> Peter L. Flom, PhD
>> Statistical Consultant
>> www DOT peterflom DOT com
Change "obs=0" to "obs=1" to get rid of the WARNING in the log (unless of
course one of the data sets is in fact empty).
The SQL set operators provide an alternative:
where libname='WORK' and memname='CLASS1'
where libname='WORK' and memname='CLASS2'
Switch the MEMNAME restrictions to get the mirror image. UNION the results
to get the composite list.