BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

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.

1 ACCEPTED SOLUTION

Accepted Solutions
rcwright
Calcite | Level 5

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

View solution in original post

6 REPLIES 6
CTorres
Quartz | Level 8

Try this:

put @001 fname  $25.

     @026 lname $25.

    @051  email  $60.

    @111  id    Z15. ;  

rcwright
Calcite | Level 5

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

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9


sorry i dont understand what you mean Smiley Sad

rcwright
Calcite | Level 5

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.

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

yes i meant right aligned,sorry

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

Thanks a lot!

RCW
Calcite | Level 5 RCW
Calcite | Level 5

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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