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: 8165
Location: East Dubuque, Illinois, 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: 965
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: 1522
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am

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