SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
UdayGuntupalli
Quartz | Level 8

All, 
    Is there a way to determine the current Time Zone Name or Time Zone ID using UTC offset ? For e.g. 

Data Test; 
       UtcOffset = -7; 
Run; 

   I would like to retrieve enough information to be able to call tzones2u function i.e. timezone id . 

 

   Alternatively, even a macro based solution is fine if I have the following 

 

%Let UtcOffset = -7; 

 

Best 

Uday

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

I don't know of a built-in function.

If there none, you can easily build an informat from the pages Time Zone IDs and Time Zone Names

UdayGuntupalli
Quartz | Level 8

@ChrisNZ , 
    I am able to implement it in a different way : 

data _null_;

start_date = datetime();

new_date1 = intnx("HOUR",start_date,-3);

format new_date1 datetime.;

put new_date1; 

run;

%Let t1 = %sysfunc(datetime()); 
%Let t2 = %sysfunc(intnx(hour,%sysfunc(datetime()),-3,same), datetime.);
%Put &t2;

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1152 views
  • 0 likes
  • 2 in conversation