Help using Base SAS procedures

Comparing multiple Obs, splitting onto seperate reports

Reply
New Contributor
Posts: 4

Comparing multiple Obs, splitting onto seperate reports

Hello all,


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);

set work.first_Keep;

run;

data work.second_REFINED (keep=ID A B C);

set work.second_Keep;

run;

*3) PROC SORT (by 'ID');

proc sort data=work.first_REFINED;

by ID;

run;

proc sort data=work.second_REFINED;

by ID;

run;

*3) Proc Compare to identify A, B and C changes from the prev month;

proc compare base = work.first_REFINED compare = work.second_REFINED

OUT=FTE_VAR OUTNOEQUAL

OUTBASE OUTCOMP OUTDIF NOPRINT;

by id;

id id;

run;

*4) Create output of diferences ONLY in Excel called 'XXX';

ods listing close;

ods tagsets.excelxp file='filepath'

options(autofilter='all'

frozen_headers='yes'

sheet_name='VAR');

proc print data=work.XXX_Var;

run;

ods tagsets.excelxp close;

ods listing;

Ask a Question
Discussion stats
  • 0 replies
  • 127 views
  • 0 likes
  • 1 in conversation