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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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