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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 2 replies
  • 642 views
  • 1 like
  • 3 in conversation