BookmarkSubscribeRSS Feed
Generalgwill
Fluorite | Level 6

I have two similar datasets generated on different days.

 

First Dataset attached called: 

Have generated on 03NOV2020

 

data have ;

format date_1 date9. ;

input id $ sp_num $ type $  date_1 yymmdd8.;

datalines;

101 a01 p 20160102

101 a01 b 20160103

102 b02 b 20160104

102 b02 b 20160105

103 c03 p 20160106

103 c03 p 20160107

103 c03 b 20160108

;

run;

 

 

The second Dataset attached called:

Want generated 30NOV2020

 

data want ;

format date_1 date9. ;

input id $ sp_num $ type $  date_1 yymmdd8.;

datalines;

101 a01 b 20160103

103 c03 b 20160108

101 a01 b 20160103

103 c03 b 20160108

101 a01 b 20160103

103 c03 e 20180108

101 a01 f 20180103

103 c03 d 20160108

101 a01 s 20180103

103 c03 e 20180108

;

run;

 

I want my OUTPUT to look like this: All new rows added to be highlighted or indicated in a new column called row_stats

 

Desired Output.PNG

I will be super excited if anyone could help me out.

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Most of us will not download and open Microsoft Excel files (or any files) because it can be a security threat. Please include a portion of your data in your message by following https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/ (and not in any other format). The desired output can be included into your reply as a screen capture.

--
Paige Miller
Generalgwill
Fluorite | Level 6
Thanks for the advice, I will do as said immediately.

Thanks again
Astounding
PROC Star

Once you have read in and sorted both data sets, use PROC COMPARE to find differences.  In this case, use a BY statement.  It will do a much more accurate and thorough job, and is much simpler than trying to code it yourself.

Generalgwill
Fluorite | Level 6
Thank you, but I look forward to a more better way were new records could be highlighted as in the image attached.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1149 views
  • 4 likes
  • 4 in conversation