IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replacing Leading Zeroes to Spaces


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Dec 11, 2008 11:50 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 12, 2008 12:30 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 12, 2008 1:54 am
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 12, 2008 2:58 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 12, 2008 4:02 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Cobol program with sequence number ra... COBOL Programming 5
Search our Forums:

Back to Top