BookmarkSubscribeRSS Feed
FP12
Obsidian | Level 7

Hi all,

 

I have a table A with a column amountA, which is character length 11

 

There is only one row where in this case amountA = "236761", but it could be "99999.09" (there can be decimals)

 

I want to transform it into numeric 20.2


So I do something like this:

 

PROC SQL;
   CREATE TABLE B AS 
   SELECT
            (input(t1.amountA,comma20.2)) FORMAT=20.2 AS Calculation
      FROM A t1;
QUIT;

In the output the value is 2367.61 => The amount have been divided by 100...

Whereas I need something like 236761 or 236761.00

 

Do you know how to manage it?

 

Thanks

 

2 REPLIES 2
Damo
SAS Employee

Hi @FP12

 

If you simply use the below statement it should do the trick (I think :))

  (input(t1.amountA,8.)) FORMAT=20.2 AS Calculation

 

Hope that helps.


Cheers,
Damo

PeterClemmensen
Tourmaline | Level 20

Use 8. informat in your INPUT function instead.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 1265 views
  • 0 likes
  • 3 in conversation