BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
couthelle
Fluorite | Level 6

Hello, 

 

I created a table using Proc Sql and used PUT() to convert numeric value to character. There are two issues that I'm now facing and hoping someone can help me:

 

1. How can I assign format and informat to those columns with no format and informat?

couthelle_0-1702670924420.png

2. For the column wherein I used put(x,9.), I got 8 spaces + . (dot) for those with no value. How do I replace this to just be simply blank?

couthelle_1-1702671037553.png

Is there a way to incorporate the solution into my proc sql table? If not what's the most efficient way to tackle these issues?

 

Thank you for your help!

 

1 ACCEPTED SOLUTION
2 REPLIES 2
Tom
Super User Tom
Super User

Also note that using PUT(x,9.) will cause the actual values to be RIGHT ALIGNED.  So numbers that only need less than 9 digits to be displayed will have leading spaces.   Is that what you want?  I noticed from the picture of your PROC CONTENTS output that you are using ODS to display things.  That will NOT display the leading spaces, which can lead to confusion then trying to compare values.

 

You could use Z9. to use leading zeros instead.

You could use 9.-L to generate trailing spaces instead.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1384 views
  • 1 like
  • 3 in conversation