BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Beto16
Obsidian | Level 7
Hi I have a table that has the time set at eastern time I need it to be local time depending what time zone...
Here is example
STATE. START. END.
TX. 02/07/16 01:59 AM. 02/07/16 02:02 AM


I need that to convert to local texas time..... I can add zip code actually I have a column that has time off set which shows an -60.
1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

You could use an informat to translate the state name into a minute offset :

 

proc format;
invalue timeZone
"TX" = -60
"NY" = 0
OTHER = 0
;
run;

data have;
infile datalines dsd dlm=".";
input STATE :timeZone. (START END) (:MDYAMPM.);
TX_start = intnx("MINUTE",START, STATE);
TX_end = intnx("MINUTE", END, STATE);
format TX_: dateampm.;
datalines;
TX. 02/07/16 01:59 AM. 02/07/16 02:02 AM.
;
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

You could use an informat to translate the state name into a minute offset :

 

proc format;
invalue timeZone
"TX" = -60
"NY" = 0
OTHER = 0
;
run;

data have;
infile datalines dsd dlm=".";
input STATE :timeZone. (START END) (:MDYAMPM.);
TX_start = intnx("MINUTE",START, STATE);
TX_end = intnx("MINUTE", END, STATE);
format TX_: dateampm.;
datalines;
TX. 02/07/16 01:59 AM. 02/07/16 02:02 AM.
;
PG
ballardw
Super User

Is there any chance you're going to be dealing with Texas times in the El Paso region? El Paso is Mountain Time zone.

 

if you have the SAS supplied SASHELP.Zipcode data set (or download it) there is time offset and daylight savings time information by Zip code that may be of use.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1583 views
  • 2 likes
  • 3 in conversation