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

Help writing a sas array


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jm_green84

New User


Joined: 13 Dec 2006
Posts: 11
Location: ATL

PostPosted: Wed May 02, 2007 9:50 pm
Reply with quote

I hav eto write a array using the following information, but I'm kinda lost and don't know where to start, any advice or input would help thanks.

Info

array meaning if a person has more than 1 row for the table each row needs to be loaded to an array field, Then output at the last row for the Person so that there is only one total row.

--------------

SSN
PRSN_INTN
PLAN_ID from PRSN_FSA_PLAN


PRSN_FSA_EFBEGDT from PRSN_FSA_PLAN
PRSN_FSA_EFENDDT from PRSN_FSA_PLAN
FSA_PLAN_AT from PRSN_FSA_PLAN
FSA_SRC_1_AT from PRSN_FSA_PLAN
(the above 4 fields pull 1 time each per row returned from PRSN_FSA_PLAN)



DED_ID from PRSN_DED



PRSN_DED_EFBEGDT from PRSN_DED
PRSN_DED_EFENDDT from PRSN_DED
DED_RPT_TS from PRSN_DED
DED_AT from PRSN_DED
(the above 4 fields pull 1 time each per row returned from PRSN_DED)



Example of a person have 2 PRSN_FSA_PLAN rows and 2 PRSN_DED rows...

SSN
PRSN_INTN
PLAN_ID from PRSN_FSA_PLAN

PRSN_FSA_EFBEGDT from PRSN_FSA_PLAN
PRSN_FSA_EFENDDT from PRSN_FSA_PLAN
FSA_PLAN_AT from PRSN_FSA_PLAN
FSA_SRC_1_AT from PRSN_FSA_PLAN

PRSN_FSA_EFBEGDT from PRSN_FSA_PLAN
PRSN_FSA_EFENDDT from PRSN_FSA_PLAN
FSA_PLAN_AT from PRSN_FSA_PLAN
FSA_SRC_1_AT from PRSN_FSA_PLAN

DED_ID from PRSN_DED

PRSN_DED_EFBEGDT from PRSN_DED
PRSN_DED_EFENDDT from PRSN_DED
DED_RPT_TS from PRSN_DED
DED_AT from PRSN_DED

PRSN_DED_EFBEGDT from PRSN_DED
PRSN_DED_EFENDDT from PRSN_DED
DED_RPT_TS from PRSN_DED
DED_AT from PRSN_DED
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu May 03, 2007 5:01 pm
Reply with quote

Here's a code that builds and loads an array in SAS.

The array is built from multiple occurences of data on the same logical input record, but should be easy enough to change to build from consecutive records.
Code:

DATA OUT01;                         
 ARRAY     TESTA(12) $ TESTA1-TESTA12
 ARRAY     TESTB(12) $ TESTB1-TESTB12
 ARRAY     TESTC(12) $ TESTC1-TESTC12
 INFILE    FILE1;                   
 DO A = 1 TO 10;                     
  POS = (A * 6) - 5;                 
  INPUT @POS TESTA(A) $6.           
        @POS TESTB(A) $6.           
        @POS TESTC(A) $6.  @;       
 END;                               
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts AI writing DFSORT, REXX codes.. All Other Mainframe Topics 3
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts Writing the output file name from a p... JCL & VSAM 7
No new posts writing into VSAM indexed tabl in PL1... PL/I & Assembler 8
Search our Forums:

Back to Top