BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DathanMD
Obsidian | Level 7

Dear Colleagues

Would be kind enough to crack this for me? Tx

I have a numerical value with decimal places. I would like to ignore the decimal places so that the new variable (want) has looks (and is equal to) the original variable after ignoring the decimal place. Kindly see an example of  the data i have versus what i want;

Have           Want
23                 23
22.1              221
0.9                 9
2.23              223
1.011             1011
0.0001           1
9                    9

 

Thank you so much

 

Dathan 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

data want;

    set have;

    y = input(compress(put(x,best10.),'.'),10.);

run;

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

data want;

    set have;

    y = input(compress(put(x,best10.),'.'),10.);

run;

--
Paige Miller
DathanMD
Obsidian | Level 7

Thank you  PaigeMiller!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 513 views
  • 0 likes
  • 2 in conversation