IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAS: DB2 equivalent query for PROC SUMMARY.


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajesh1183

New User


Joined: 07 Jan 2008
Posts: 98
Location: Hyderabad

PostPosted: Wed Nov 11, 2009 7:25 pm
Reply with quote

Hi all,


Is it possible to write a DB2 equivalent query for PROC SUMMARY...?

If so, could you kindly provide me the inputs about this topic...

I have a file which contains around 20 million records. Huge amount of time is consuming every time I sort these 20 million records and summarize them.

Thanks...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 11, 2009 7:48 pm
Reply with quote

If your site is licensed for SAS/ACCESS, there is a DB2 interface directly between SAS and DB2.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 11, 2009 11:55 pm
Reply with quote

Is it possible to extract the records via the SQL query in the correct order, whilst marking the SAS output table as SORTED BY ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 11, 2009 11:59 pm
Reply with quote

I suspect so, expat, PROC SQL supports the ORDER BY clause and the SAS data set would therefore be sorted. But I don't have any good way to test it since we're not running DB2.
Back to top
View user's profile Send private message
rajesh1183

New User


Joined: 07 Jan 2008
Posts: 98
Location: Hyderabad

PostPosted: Thu Nov 12, 2009 10:39 am
Reply with quote

Yes, My site contains SAS/Access for DB2.

What is that interface and how can I implement it.. Could you please provide me some details..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 12, 2009 5:46 pm
Reply with quote

Go to www.sas.com then click on Support&Training then do some searches for exactly what you need to know. SAS has their complete documentation on their web site, along with Tech Notes, sample code, and a variety of other helpful tidbits.
Back to top
View user's profile Send private message
rajesh1183

New User


Joined: 07 Jan 2008
Posts: 98
Location: Hyderabad

PostPosted: Mon Dec 07, 2009 6:16 pm
Reply with quote

Here is my finding..

Proc Summary code:
Code:


PROC SORT DATA = WORK.PREMIUM
                   OUT = WORK.PREMIUM1;
             BY  YEAR                                   
                   QUARTER                                   
                   MONTH                                   
                   POLICY_CENTER                                   
                   PARTNER_CODE     ;                       
RUN;

PROC SUMMARY DATA=WORK.PREMIUM1;                             
      OUTPUT  OUT=WORK.PREMIUM2 SUM=; 
             BY  YEAR                                   
                   QUARTER                                   
                   MONTH                                   
                   POLICY_CENTER                                   
                   PARTNER_CODE     ;                       
           VAR  USD_PREMIUMM   
                   USD_CLAIM;
RUN;


DB2 equivalent code:
Code:

PROC SQL;
CREATE TABLE WORK.PREMIUM2 AS
Select          YEAR,                                   
                   QUARTER,                                   
                   MONTH,                                   
                   POLICY_CENTER,                                   
                   PARTNER_CODE,                             
                   Sum(USD_PREMIUMM),   
                   Sum(USD_CLAIM),
from WORK.PREMIUM1
GROUP BY YEAR,                                   
                   QUARTER,                                   
                   MONTH,                                   
                   POLICY_CENTER,                                   
                   PARTNER_CODE,                             
;
QUIT;


I tried this but it(query) was unable to handle large data... :-(

Corrections are welcome...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top