BookmarkSubscribeRSS Feed
bryan22
Calcite | Level 5

Hi, I am trying to sum a text field that has currency values with a $ in front ($1,109.23 for example).  I am using the code below but am getting nulls returned.  Any way I can do this?  Thanks.

 

sum(input(substr(dollar_value,2,length(dollar_value)-1),20.))

 

1 REPLY 1
Astounding
PROC Star

The code you have shown is but a piece of a SAS statement.  So I have to assume that the context in which you are using it is correct.  This would be the replacement code for a variable that is defined as character with a length of 20:

 

sum(input(dollar_value, dollar20.))

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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 732 views
  • 1 like
  • 2 in conversation