Your SAS programs, embedded in web apps and elsewhere

Proc Sql - get current hour.

Reply
Occasional Contributor
Posts: 6

Proc Sql - get current hour.

Hello!

I´m using a Customer Intelligence 5.4 and i have in a Process Node, into this node i have a "proc sql" i need to filter records per hour, and this hour is in a datetime field.

In SQL I would do as follows: "convert(varchar(2), FIELD, 114)" what would be the equivalent in SAS?

Thanks!!!!!!!!!!

PROC Star
Posts: 7,492

Proc Sql - get current hour.

Posted in reply to Samuel_Rocha

Will something like the following suffice?:

data have;

  thedate=datetime();

run;

proc sql;

  select hour(timepart(thedate))

    from have

  ;

quit;

Ask a Question
Discussion stats
  • 1 reply
  • 663 views
  • 0 likes
  • 2 in conversation