Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Keyword or facility to compare 2 files in SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Wed Mar 07, 2007 2:35 am    Post subject: Keyword or facility to compare 2 files in SAS
Reply with quote

Hi,

Is there any keyword or facility to compare 2 files in SAS and produce output based on MATCHED and UNMATCHED records ? I used this in Eazytrieve in my previous company, but in this company there is no Eazytrieve. icon_sad.gif

SAS, FILEAID, CLIST is used .

Please suggest me on some other options. I don't want to write this in COBOL icon_mad.gif
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2007 2:43 am    Post subject:
Reply with quote

Hello,

I don't know about SAS, but if you look in the sort forum, you will se examples of what you are looking for.
Back to top
View user's profile Send private message
Aryang4u

New User


Joined: 21 Feb 2006
Posts: 8
Location: Los Angels, CA

PostPosted: Wed Mar 07, 2007 11:13 am    Post subject:
Reply with quote

In SAS you can use the Merge function. Let me know if you need programs.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Mar 07, 2007 11:34 am    Post subject:
Reply with quote

Please post the code it can be helpful
Back to top
View user's profile Send private message
Aryang4u

New User


Joined: 21 Feb 2006
Posts: 8
Location: Los Angels, CA

PostPosted: Wed Mar 07, 2007 12:24 pm    Post subject:
Reply with quote

Read two files.

suppose master & adhoc are two files. You are merging based on case id field.

match data set will give you matched records.
unmatch data set will give you unmatched records.
unmatch1 data set will give you records which are in adhoc file and not in master file.
---------------------------------------------
data match
unmatch
unmatch1;
merge master (in=inmaster)
adhoc (in=inout);
by caseid;
if inmaster and inout then output match;
else if inmaster and not inout then output unmatch;
else if inout and not inmaster then output unmatch1;
run;
--------------------------------------------
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Wed Mar 07, 2007 8:08 pm    Post subject:
Reply with quote

Continuing with Aryan's code:

1. An earlier DATA step must read each flat file and convert to a SAS dataset.
2. If you forget the "BY CASEID;" line, it will match 1-1 by record position, rather than giving an error/warning.
3. Files must be ordered by CASEID.
4. Most importantly - if MASTER has, say, 3 recs with a given CASEID value, and ADHOC has, say, 5 recs, then they will match 1-1 through the first three recs, then MASTER's last record (the 3rd for this value) will continue to match the remaining ADHOC recs (4th-5th with this value)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts COOLGEN - TSO TEST FACILITY indianrajput CA Products 4 Wed Nov 02, 2016 9:28 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us