Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 7996
Location: Bellevue, IA

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: 962
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: 1475
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 Unable to catalog a gdg dataset resid... Shovan JCL & VSAM 7 Fri Mar 24, 2017 2:24 pm
No new posts Want to pull the job log into a Mainf... Jishu Mukherjee Compuware & Other Tools 9 Tue Mar 21, 2017 4:48 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us