DATA Step, Macro, Functions and more

question about substr

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

question about substr

data a;
sub1="*"||substr(1234.5678,1,6)||"*";

run;

 

why in the result there are some blanks before 1234?

 


Accepted Solutions
Solution
‎08-10-2016 03:17 PM
Respected Advisor
Posts: 4,649

Re: question about substr

Read the SAS log! 

 

The first argument to SUBSTR must be of type character. A number will be converted to a right justified character string using sometinng like the BEST12. format, i.e. including some leading blanks. 

You can control the convertion result with functions PUT, LEFT, and STRIP.

 

PG

View solution in original post


All Replies
Solution
‎08-10-2016 03:17 PM
Respected Advisor
Posts: 4,649

Re: question about substr

Read the SAS log! 

 

The first argument to SUBSTR must be of type character. A number will be converted to a right justified character string using sometinng like the BEST12. format, i.e. including some leading blanks. 

You can control the convertion result with functions PUT, LEFT, and STRIP.

 

PG
Contributor
Posts: 31

Re: question about substr

thanks!

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 252 views
  • 0 likes
  • 2 in conversation