11-13-2013 04:39 AM
I'm new to sas (and the support community) so apologies in advance should I commit any faux pas.
I have the following, which compares three variables (A B C) by a ID number which will be identical between the base and compare sheets - the ID number.
2 reports and produces an excel 'execption report' - excellent!
However, for each of A B C that I'm comparing, I'm looking to split the variances onto a seperate excel tab for each Ob. So have a sheet for variances in A, one for B, one for C etc.
And... one the variances A sheet for example, I'd still like to list the values stated for B and C etc etc.
Hope that makes sense! It is so simple in my head, just trying to get it into code!
Any help would be truly appreciated
Note: I've changed variable names, filepaths etc because I'm secret!
2) DATA step to keep the data required (ID, A, B, C);
data work.first_REFINED (keep=ID A B C);
data work.second_REFINED (keep=ID A B C);
*3) PROC SORT (by 'ID');
proc sort data=work.first_REFINED;
proc sort data=work.second_REFINED;
*3) Proc Compare to identify A, B and C changes from the prev month;
proc compare base = work.first_REFINED compare = work.second_REFINED
OUTBASE OUTCOMP OUTDIF NOPRINT;
*4) Create output of diferences ONLY in Excel called 'XXX';
ods listing close;
ods tagsets.excelxp file='filepath'
proc print data=work.XXX_Var;
ods tagsets.excelxp close;