LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Aug 1999 18:05:33 +0200
Reply-To:     Torsten.Petsching@BC.BOEHRINGER-INGELHEIM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Torsten.Petsching@BC.BOEHRINGER-INGELHEIM.COM
Subject:      Thanks PROC COMPARE
Content-Type: text/plain

Thanks to Shiling Zhang, Nancy Brucken, Rainer Diebow, Ron Fehd, Mattew M. Zack for their proposals how to compare automatically data sets in two different directories. The easiest way for me to handle this was according Shiling's and Nancy's code examples:

1. create a new data set containing the available data set names reading from either SASHELP.VTABLE (using a Proc Sort step) or DICTIONARY.TABLES (using Proc SQL) 2. create macro variables for all the different names 3. do the Proc Compare step for all those macro variables

See below the code that worked fine for me:

libname lib1 "c:\temp\morefun"; libname lib2 "c:\temp\mostfun";

*= read the available data set names =*; proc sort data=sashelp.vtable(where=(libname in ('LIB1','LIB2')) keep=memname) out=t1; by memname; run;

*= keep each name only once and write message to log =*; *= if a name is not available in both directories =*; *= so far no need to check for availability of the =*; *= variable names =*; data t2; set t1; by memname; if last.memname then do; if first.memname then put "dataset " memname " exists only in library " libname " ."; delete; end; run;

*= create macro variables for each data set name =*; data _null_; set t2 end=end; call symput(compress('dsn'||_n_),compress(memname)); if end then call symput('n', compress(_n_)); run;

%macro comp; %do i = 1 %to &n; proc compare data=lib1.&&dsn&i compare=lib2.&&dsn&i nosummary; title1 " "; run; %end; %mend;

%comp


Back to: Top of message | Previous page | Main SAS-L page