I'm trying to perform a roundup function to mimic the function in Excel where I want to round up to the nearest decimal.
For example I would like to round -0.2011 to -.202
I've tried round, ceil, and floor but I can't seem to get it to round at the decimal level, only the integer level.
Any help would be greatly appreciated.
Thanks!
newvalue=round(value+0.0005,0.001);
or
newvalue=ceil(1000*value)/1000;
If you are familiar with CEIL and FLOOR, you can probably do this yourself.
First, multiply by 1000. Then apply CEIL or FLOOR (might depend on whether the number is positive or negative). Then divide by 1000.
Be careful when you say rounding up or rounding down. To the mathematician, -0.2011 to -0.202 is rounding down.
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.
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.