BookmarkSubscribeRSS Feed
AaroninMN
Obsidian | Level 7
Is there a rounddown function in EG?
I'd like my data to be like this:
2.3 = 2
2.4 = 2
2.5 = 2
2.6 = 2
2.7 = 2
2.8 = 2
2.9 = 2
3.0 = 3

Any help would be appreciated.

Thanks!
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The DATA step FLOOR or possibly the INT function.

Scott Barry
SBBWorks, Inc.
AaroninMN
Obsidian | Level 7
Thanks Scott. The INT function worked.
GenDemo
Quartz | Level 8

Hi

 

I'm also looking into this at the moment. I am working with date and time stamps, and want to round down to the nearest minute - this means I would like round down a number to the nearest increment of 60.

Currently I am using round(floor(timepart(a.update_dt)/60)*60, 1) .

Does anyone have a difference/better solution?

andreas_lds
Jade | Level 19

Using the intnx-function seems to be better:

 

data _null_;
   d = datetime();
   put d datetime.;
   r = intnx('dtminutes', d, 0, 'B');
   put r datetime.;
run;
GenDemo
Quartz | Level 8
Hahahaha, touché !

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1354 views
  • 1 like
  • 4 in conversation