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
 
How to intialize field in SAS dataset.

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

New User


Joined: 27 Nov 2008
Posts: 51
Location: Delhi, India

PostPosted: Mon Jan 17, 2011 6:40 pm    Post subject: How to intialize field in SAS dataset.
Reply with quote

Hi,
I am fetching data from database via SAS SQL query. Now I an trying to reformat fetched data via SAS statements. I want to initialize one field and want zeros for all records.

Please advise.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Mon Jan 17, 2011 7:49 pm    Post subject:
Reply with quote

Code:
VAR = 0;
RETAIN VAR;
is the easiest way. If you explain -- in detail -- what you're looking for, we can provide a better solution. But based on what you wrote, this code will give you a variable initialized to zero and kept for all observations.

Since you didn't tell us anything about what you want to reformat, just how do you think we can provide any assistance?
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


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

PostPosted: Mon Jan 17, 2011 10:10 pm    Post subject:
Reply with quote

Maybe you want something like this in your proc sql?

select ...
<one or more columns>,
0 as var-name
from <table>
Back to top
View user's profile Send private message
ppandey07

New User


Joined: 27 Nov 2008
Posts: 51
Location: Delhi, India

PostPosted: Mon Jan 17, 2011 10:29 pm    Post subject:
Reply with quote

Robert Sample wrote:
Code:
VAR = 0;
RETAIN VAR;
is the easiest way. If you explain -- in detail -- what you're looking for, we can provide a better solution. But based on what you wrote, this code will give you a variable initialized to zero and kept for all observations.

Since you didn't tell us anything about what you want to reformat, just how do you think we can provide any assistance?


The solution you provided is working for me.
Thank you!!!
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1535
Location: Chennai

PostPosted: Tue Jan 18, 2011 5:41 pm    Post subject:
Reply with quote

Hi,
RETAIN VAR 0;
would also work, If u want to avoid few keystrokes icon_smile.gif

hope it helps.
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 Where to get sample for processing RM... vice_versa PL/I & Assembler 2 Tue Jan 16, 2018 2:03 pm
No new posts VSAM dataset not found abdulrafi JCL & VSAM 5 Fri Jan 12, 2018 11:19 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm

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