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 report genration problem

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

New User


Joined: 27 Aug 2010
Posts: 2
Location: Chennai

PostPosted: Sat Aug 25, 2012 5:32 pm    Post subject: SAS report genration problem
Reply with quote

Hi,
This is my first post to this forum and I tried searching my problem in other topics but couldn't find it.
I am very new to SAS programming and wrote few report creation program based on existing ones but I am facing a problem with a new one now.

My requirement is to read from 2nd last line if a particular string is found in the current file read pointer.
Is there any specific function/command in SAS if I can do it. Or need to read the file twice (first to calculate the required row then to fetch the line required ) Or is there any other easy way. I am looking into SAS manuals for sometime but if anyone can help I will be grateful.

Thanks,
goran
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Sat Aug 25, 2012 5:49 pm    Post subject:
Reply with quote

You can use the LAG1 function in SAS to hold an observation over to the next observation. So something like this should work for your need:
Code:
DATA X;
     INFILE DD01 END=EOF;
     INPUT @001 DATALINE $CHAR<fill in length of record>;
     HOLDLINE = LAG1(DATALINE) ;
     <other logic>
     IF  EOF
     THEN DO;
          <HOLDLINE has the next-to-last line's data so use it as needed>
          END;
Back to top
View user's profile Send private message
goran

New User


Joined: 27 Aug 2010
Posts: 2
Location: Chennai

PostPosted: Mon Aug 27, 2012 4:58 am    Post subject: Reply to: SAS report genration problem
Reply with quote

Hi Robert,

Thank you very much for the reply! what I understood is that LAG3 will be needed for this scenario..

Cheers,
goren
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Aug 27, 2012 5:35 am    Post subject: Re: Reply to: SAS report genration problem
Reply with quote

goran wrote:
Hi Robert,

Thank you very much for the reply! what I understood is that LAG3 will be needed for this scenario..

Cheers,
goren


well, I am sure that you have tested it,
so which one works, LAG1 or LAG3?
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 LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts Report cost in CA-dispatch Nileshkul CA Products 3 Wed Jun 07, 2017 10:32 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 7 Mon Mar 27, 2017 3:59 pm

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