BookmarkSubscribeRSS Feed
Smitha9
Fluorite | Level 6

Hi,

I have a dataset:

a 243.199965

b 345

c 123

 

I want the decimal only 2:

a 243.19

b 345.00

c 123.56

 

can anyone help me in this. thanks in advance

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

Hi:
There is a difference between the internally stored number and displaying a number on a report. You don't explain whether this is for a report or whether you want to change the number of decimal places in the stored data. Consider this:

Cynthia_sas_0-1629838784445.png

 



You can use the round function to change the internally stored value for a variable (as I do with the creation of the NEWVAR variable). But if you only care about the display for reporting, then you might want to allow the number to have full decimal places when stored.

Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1984 views
  • 2 likes
  • 3 in conversation