Help using Base SAS procedures

output file

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 440
Accepted Solution

output file

hi guys,

i am supposed to write these four var to an output file and my id must be a  char variable starting from position 111 ending position 125

but they get left justified ,probably cuz they are numeric . is there a  way i can move them to start from position 111 without beeing converted to char var?

put @001 fname              25.

    @026  lname              25.

    @051  email             60.

    @111  id                 15.


Accepted Solutions
Solution
‎09-19-2014 10:04 AM
Contributor
Posts: 26

Re: output file

Try 25.-L as format (-L left aligns, -C Centers, -R right aligns)

View solution in original post


All Replies
Regular Contributor
Posts: 180

Re: output file

Try this:

put @001 fname  $25.

     @026 lname $25.

    @051  email  $60.

    @111  id    Z15. ;  

Solution
‎09-19-2014 10:04 AM
Contributor
Posts: 26

Re: output file

Try 25.-L as format (-L left aligns, -C Centers, -R right aligns)

Super Contributor
Super Contributor
Posts: 440

Re: output file


sorry i dont understand what you mean Smiley Sad

Contributor
Posts: 26

Re: output file

PUT @1 fname

...

          @111 id 15.-L

;

sorry about the 25. - I thought id was the first variable

In your question you state id gets left aligned, but I'm assuming you misstated that - I think you meant right aligned.

This will left align id starting at column 111.

If you wanted to center the value, use -C, if you want to right align(default for numeric variables), use -R

Look in online manual under PUT formatted for explanation and other examples.

Super Contributor
Super Contributor
Posts: 440

Re: output file

yes i meant right aligned,sorry

but see,i did not know about this L,R and C. Very handy.

Thanks a lot!

New Contributor RCW
New Contributor
Posts: 4

Re: output file

Ahh ... but I did - that's what makes these communities so handy. Learn something new every day. And I've been doing this about 30 years.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 285 views
  • 6 likes
  • 4 in conversation