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
 

 

Replacing Leading Zeroes to Spaces

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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Dec 11, 2008 11:46 pm    Post subject: Replacing Leading Zeroes to Spaces
Reply with quote

Hi,

In SAS is there a way where we can replace the leading zeroes with Spaces ??

thanks
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Thu Dec 11, 2008 11:50 pm    Post subject:
Reply with quote

Leading zeroes in what? Output just requires a w.d format -- other situations depends on what you're wanting.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Dec 12, 2008 12:19 am    Post subject: Reply to: Replacing Leading Zeroes to Spaces
Reply with quote

To my SAS program, I have a input field which has value of

00000000012

I am writing this feild to my output file.
I need to write the above field as 12, instead of 00000000012.

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Dec 12, 2008 12:30 am    Post subject:
Reply with quote

What is the input statement for the variable look like? What does your output statement look like? Generally if you just say
Code:
PUT VAR 11.
it will come out right justified, left blank filled -- standard numeric variable processing.

If it is a character variable, you can do
Code:
NUMVAR = INPUT (VAR,11.);
and output NUMVAR instead of VAR.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Dec 12, 2008 1:38 am    Post subject: Reply to: Replacing Leading Zeroes to Spaces
Reply with quote

Hi,

My input variable is defined as below

Code:
POL_NUM    $CHAR16


I am writing it as

Code:
@1    POL_NUM
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Dec 12, 2008 1:54 am    Post subject:
Reply with quote

Code:
POL_NUM_INT = INPUT(POL_NUM,16.) ;



@1 POL_NUM_INT 11.
should get it.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Dec 12, 2008 2:25 am    Post subject: Reply to: Replacing Leading Zeroes to Spaces
Reply with quote

Hi,

When I do as shown below
Input defination:
Code:
POL_NUM    $CHAR16



Code:
POL_NUM_INT = INPUT(POL_NUM,16.0);


output write :
Code:
@1    POL_NUM_INT


My output is

Code:
1             


What I need is

Code:
            1


it should be right justified and not left justified.

Can someone pls advise ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Dec 12, 2008 2:58 am    Post subject:
Reply with quote

Hello,

Quote:
it should be right justified and not left justified.

Can someone pls advise ?
Suggest you look at the prior replies - this answer was given earlier.
Quote:
it will come out right justified, left blank filled -- standard numeric variable processing.
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Dec 12, 2008 3:29 am    Post subject: Reply to: Replacing Leading Zeroes to Spaces
Reply with quote

My apologies.. I implemented as suggested and it worked for me.

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Dec 12, 2008 4:02 am    Post subject:
Reply with quote

Glad to hear it's working.
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 replacing junk with hyphen Nitin32 DFSORT/ICETOOL 10 Fri Jun 02, 2017 7:47 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


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