RoliPoliOli
RoliPoliOli

Reputation: 9

In SAS, how would I remove a decimal from a value?

I have a few million rows, where a particular columns’ values are showing as I.e. ###.## and I’d like them to show them as #####.

How can I modify this in the INFILE statement?

Thanks.

Upvotes: 0

Views: 518

Answers (1)

Tom
Tom

Reputation: 51566

It you made the mistake of including a decimal width on in INFORMAT then that might be the cause of what you are seeing. The decimal width on an informat is for letting SAS know where the implied decimal place should be placed. You only want to do that when you know that your source strings were purposely generated without a period to mark the decimal place to save one character.

Example:

data have;
  input @1 right 10. @1 wrong 10.3 ;
cards;
1.2
1234
;

Result:

Obs     right    wrong

 1        1.2    1.200
 2     1234.0    1.234

Upvotes: 2

Related Questions