<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: convert datetimes to another time zone in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40207#M8153</link>
    <description>No specific "tool" - you need only use some data condition to test (revealing the time-zone), and then use a DATA step (or PROC SQL) programming technique to adjust (either increment or decrement) the SAS DATETIME variable value.&lt;BR /&gt;
&lt;BR /&gt;
One example using a SAS assignment statement within a DATA step:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
format UTC_DT Local_DT DATETIME21. ;&lt;BR /&gt;
UTC_DT = datetime();  /* assign current SAS datetime var */&lt;BR /&gt;
if (&lt;SOME_EXPRESSION&gt;) then TimeZoneOffset = -"5:00:00"t;&lt;BR /&gt;
else if (&lt;ANOTHER_EXPRESSION&gt;) then TimeZoneOffset = -"6:00:00"t;&lt;BR /&gt;
else do;&lt;BR /&gt;
  * unknown condition code - abort maybe? ;&lt;BR /&gt;
end;&lt;BR /&gt;
Local_DT = SUM(UTC_DT,TimeZoneOffset);&lt;BR /&gt;
putlog _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
date datetime variables site:sas.com&lt;/ANOTHER_EXPRESSION&gt;&lt;/SOME_EXPRESSION&gt;</description>
    <pubDate>Fri, 26 Nov 2010 19:10:54 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-11-26T19:10:54Z</dc:date>
    <item>
      <title>convert datetimes to another time zone</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40206#M8152</link>
      <description>I have a variable with the following three observations in datetime format.&lt;BR /&gt;
'11OCT2010:10:28:47'&lt;BR /&gt;
'17OCT2010:12:21:47'&lt;BR /&gt;
'27OCT2010:16:14:47'&lt;BR /&gt;
These date times are in UTC (coordinated universal time). I would like to convert them to PST (pacific standard).&lt;BR /&gt;
Does SAS have a tool for converting date time values to other time zones?</description>
      <pubDate>Fri, 26 Nov 2010 18:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40206#M8152</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2010-11-26T18:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: convert datetimes to another time zone</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40207#M8153</link>
      <description>No specific "tool" - you need only use some data condition to test (revealing the time-zone), and then use a DATA step (or PROC SQL) programming technique to adjust (either increment or decrement) the SAS DATETIME variable value.&lt;BR /&gt;
&lt;BR /&gt;
One example using a SAS assignment statement within a DATA step:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
format UTC_DT Local_DT DATETIME21. ;&lt;BR /&gt;
UTC_DT = datetime();  /* assign current SAS datetime var */&lt;BR /&gt;
if (&lt;SOME_EXPRESSION&gt;) then TimeZoneOffset = -"5:00:00"t;&lt;BR /&gt;
else if (&lt;ANOTHER_EXPRESSION&gt;) then TimeZoneOffset = -"6:00:00"t;&lt;BR /&gt;
else do;&lt;BR /&gt;
  * unknown condition code - abort maybe? ;&lt;BR /&gt;
end;&lt;BR /&gt;
Local_DT = SUM(UTC_DT,TimeZoneOffset);&lt;BR /&gt;
putlog _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
date datetime variables site:sas.com&lt;/ANOTHER_EXPRESSION&gt;&lt;/SOME_EXPRESSION&gt;</description>
      <pubDate>Fri, 26 Nov 2010 19:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40207#M8153</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-26T19:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: convert datetimes to another time zone</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40208#M8154</link>
      <description>Under Windows and Unix there is the TZ environment variable that might prove to be useful.  Take a look at:&lt;BR /&gt;
&lt;A href="http://www.lexjansen.com/pharmasug/2010/sas/sas-tt-sas01.pdf" target="_blank"&gt;http://www.lexjansen.com/pharmasug/2010/sas/sas-tt-sas01.pdf&lt;/A&gt;</description>
      <pubDate>Fri, 26 Nov 2010 19:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-datetimes-to-another-time-zone/m-p/40208#M8154</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-11-26T19:57:38Z</dc:date>
    </item>
  </channel>
</rss>

