Hi All ,
I would like create a customised report by comparing two data set ..
Example consider the below two data sets SOURCE and TARGET .. All i wanted to achieve is produce a report on mismatch value by using primary key
SOURCE | ||||
PRIMARY_KEY | Value1 | Value2 | Value3 | Value4 |
200124 | 23.64 | 3.55 | 3.96 | 27.6 |
200125 | 25.7 | 3.86 | 4.31 | 30.01 |
200126 | 25.7 | 3.86 | 4.31 | 30.01 |
200127 | 34.26 | 5.14 | 5.74 | 40 |
TARGET | ||||
PRIMARY_KEY | Value1 | Value2 | Value3 | Value4 |
200124 | 23.64 | 3.55 | 3.96 | 27.89 |
200125 | 25.7 | 3.86 | 4.31 | 30.23 |
200126 | 78.2 | 3.86 | 14.8 | 30.01 |
200127 | 34.26 | 5.14 | 5.74 | 40 |
REPORT LIKE BELOW
------------------------------
PRIMARY_KEY_Source | PRIMARY_KEY_Target | Compare | Value1_Source | Value1_Target | Compare(1) | Value2_Source | Value2_Target | Compare |
200124 | 200124 | TRUE | 23.64 | 23.64 | TRUE | 3.55 | 3.55 | TRUE |
200125 | 200125 | TRUE | 25.7 | 25.7 | TRUE | 3.86 | 3.86 | TRUE |
200126 | 200126 | TRUE | 25.7 | 78.2 | FALSE | 3.86 | 3.86 | TRUE |
200127 | 200127 | TRUE | 34.26 | 34.26 | TRUE | 5.14 | 5.14 | TRUE |
I tried using PROC_COMPARE however i don't know how to customise .. please can some one help me im very new to SAS programming
Proc compare will not create a report as you want, but have you tried:
proc compare base=source compare=target
criterion=0.01;
id primary_key;
run;
More options documented in
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.