Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SAS MERGE to DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Musab Ahmed

New User


Joined: 10 Dec 2012
Posts: 37
Location: India

PostPosted: Mon Feb 01, 2016 5:44 pm    Post subject: SAS MERGE to DFSORT
Reply with quote

I am currently assigned to a project to migrate SAS written code to DFSORT/PL1.

I came across the MERGE statement in SAS which is as follows:

MERGE inp01(in=a) inp02(in=b); by PAX_JNCD;

IF A & B THEN;process;

where inp01 and inp02 are two SAS datasets having a common variable PAX_JNCD.

To convert this to DFSORT, May i perform a JOIN on the two datasets with PAX_JNCD as a key and then reformat the matched records accordingly? Is my approach correct?

That is SAS MERGE BY can be implemented as a JOIN in DFSORT??
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Mon Feb 01, 2016 7:32 pm    Post subject:
Reply with quote

Musab Ahmed,
Please describe what you need and not provide what's present and perceived by you. Many users here may not know SAS.

Yes SAS MERGE BY can be performed by DFSort.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8187
Location: East Dubuque, Illinois, USA

PostPosted: Mon Feb 01, 2016 8:13 pm    Post subject:
Reply with quote

The snippet you posted does the process when the indicated values (PAX_INCD) is the same on both files. There is no indication what happens when the value exists only on one file. DFSORT can handle such a condition via the JOIN.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1528
Location: Chennai

PostPosted: Tue Feb 02, 2016 4:37 pm    Post subject:
Reply with quote

If the SAS merge is a MANY to MANY merge then you would have problems mimicking it via DFSORT.
i.e. When you have duplicate values for key variables in both input files simultaneously.

DATA step merge does not generate a cartesian product of the merged values when it comes to MANY to MANY merges.
One symptom to diagnose this scenario is via SASLOG where there would be a NOTE saying
Code:
“NOTE: MERGE statement has more than one data set with
repeats of BY values”
Back to top
View user's profile Send private message
Musab Ahmed

New User


Joined: 10 Dec 2012
Posts: 37
Location: India

PostPosted: Tue Feb 02, 2016 7:14 pm    Post subject:
Reply with quote

Hi,

Yes I tried replicating the code with DFSORT JOIN keys concept and it gave a cartesian product which is not the case with SAS MERGE.

Need to think of some other possibility of doing this.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1528
Location: Chennai

PostPosted: Tue Feb 02, 2016 7:23 pm    Post subject:
Reply with quote

Maybe show us sample input and output files. And the scenario for merge.
Some of the DFSORT Gurus might be able to help you out.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Tue Feb 02, 2016 7:53 pm    Post subject: Reply to: SAS MERGE to DFSORT
Reply with quote

You need to describe exactly what you want instead of a cartesian product, with, as has been mentioned, representative sample input and expected output.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us