<?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: SAS won't import UTC time stamps from CSV file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325816#M271465</link>
    <description>&lt;P&gt;That fixed it, thanks so much!&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2017 21:45:09 GMT</pubDate>
    <dc:creator>starky987</dc:creator>
    <dc:date>2017-01-18T21:45:09Z</dc:date>
    <item>
      <title>How to import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325753#M271459</link>
      <description>&lt;P&gt;I have a file that is in CSV format. The time stamps are in the format&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2011-12-30T05:00:00Z&lt;/P&gt;
&lt;P&gt;2012-04-09T04:00:00Z&lt;/P&gt;
&lt;P&gt;2014-03-10T04:00:00Z&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I import them into SAS using the import wizard, they all show up as the same&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01JAN60:00:00:00&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;01JAN60:00:00:00&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;01JAN60:00:00:00&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have discovered that the problem is the portion "T05:00:00Z". If I delete this from the observations I can import the dates correctly, though it drops the time portion of the date/time variable. This is not a viable solution for two reasons: (1) The file is too large to even open in excel so I do not know how to find and delete all the time stamps from the date/time variable and (2) although this example is daily observations (ie. they all have the same time portion of the date/time stamp), I have another file that is intraday so the time stamp is important.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325753#M271459</guid>
      <dc:creator>starky987</dc:creator>
      <dc:date>2017-01-18T19:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325758#M271460</link>
      <description>&lt;P&gt;If you're using proc import, why not simply grab the code it is using (as shown in your log) and change the informat for that(those) variable(s) to&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;A name="a003065430" target="_blank"&gt;&lt;/A&gt;E8601DZ&lt;SPAN class="emph"&gt;w.d&lt;/SPAN&gt; Informat&lt;/H1&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;see:&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065430.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065430.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 18:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325758#M271460</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-18T18:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325759#M271461</link>
      <description>&lt;P&gt;Thanks for the reply. My import code looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.a&lt;BR /&gt;DATAFILE= "E:\Research\....file.csv"&lt;BR /&gt;DBMS=CSV REPLACE;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;DATAROW=2;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not entirely sure how you are suggesting to change the code. Could you provide an example given what is above?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 18:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325759#M271461</guid>
      <dc:creator>starky987</dc:creator>
      <dc:date>2017-01-18T18:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325760#M271462</link>
      <description>&lt;P&gt;After you run that code, open and copy (ctrl-c) your log and paste (ctrl-v) it here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 18:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325760#M271462</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-18T18:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325761#M271463</link>
      <description>&lt;P&gt;60 data WORK.ABC ;&lt;BR /&gt;61 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;62 infile 'E:\Research\Data\filename.csv' delimiter =&lt;BR /&gt;62 ! ',' MISSOVER DSD lrecl=32767 firstobs=2 ;&lt;BR /&gt;63 informat SOURCE $10. ;&lt;BR /&gt;64 informat SYMBOL $4. ;&lt;BR /&gt;65 informat TIMESTAMP_UTC anydtdtm40. ;&lt;BR /&gt;66 informat BULLISH_INTENSITY best32. ;&lt;BR /&gt;67 informat BEARISH_INTENSITY best32. ;&lt;BR /&gt;68 informat BULL_MINUS_BEAR best32. ;&lt;BR /&gt;69 informat BULL_SCORED_MESSAGES best32. ;&lt;BR /&gt;70 informat BEAR_SCORED_MESSAGES best32. ;&lt;BR /&gt;71 informat BULL_BEAR_MSG_RATIO best32. ;&lt;BR /&gt;72 informat TOTAL_SCANNED_MESSAGES best32. ;&lt;BR /&gt;73 format SOURCE $10. ;&lt;BR /&gt;74 format SYMBOL $4. ;&lt;BR /&gt;75 format TIMESTAMP_UTC datetime. ;&lt;BR /&gt;76 format BULLISH_INTENSITY best12. ;&lt;BR /&gt;77 format BEARISH_INTENSITY best12. ;&lt;BR /&gt;78 format BULL_MINUS_BEAR best12. ;&lt;BR /&gt;79 format BULL_SCORED_MESSAGES best12. ;&lt;BR /&gt;80 format BEAR_SCORED_MESSAGES best12. ;&lt;BR /&gt;81 format BULL_BEAR_MSG_RATIO best12. ;&lt;BR /&gt;82 format TOTAL_SCANNED_MESSAGES best12. ;&lt;BR /&gt;83 input&lt;BR /&gt;84 SOURCE $&lt;BR /&gt;85 SYMBOL $&lt;BR /&gt;86 TIMESTAMP_UTC&lt;BR /&gt;87 BULLISH_INTENSITY&lt;BR /&gt;88 BEARISH_INTENSITY&lt;BR /&gt;89 BULL_MINUS_BEAR&lt;BR /&gt;90 BULL_SCORED_MESSAGES&lt;BR /&gt;91 BEAR_SCORED_MESSAGES&lt;BR /&gt;92 BULL_BEAR_MSG_RATIO&lt;BR /&gt;93 TOTAL_SCANNED_MESSAGES&lt;BR /&gt;94 ;&lt;BR /&gt;95 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */&lt;BR /&gt;96 run;&lt;/P&gt;&lt;P&gt;NOTE: The infile 'E:\Research\Data\filename.csv' is:&lt;BR /&gt;Filename=E:\Research\Data\filename.csv,&lt;BR /&gt;RECFM=V,LRECL=32767,File Size (bytes)=6326951,&lt;BR /&gt;Last Modified=03Jan2017:19:17:20,&lt;BR /&gt;Create Time=18Jan2017:11:47:25&lt;/P&gt;&lt;P&gt;NOTE: 102660 records were read from the infile&lt;BR /&gt;'E:\Research\Data\filename.csv'.&lt;BR /&gt;The minimum record length was 56.&lt;BR /&gt;The maximum record length was 97.&lt;BR /&gt;NOTE: The data set WORK.ABC has 102660 observations and 10 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.56 seconds&lt;BR /&gt;cpu time 0.53 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;102660 rows created in WORK.ABC from&lt;BR /&gt;E:\Research\Data\filename.csv.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: WORK.ABC data set was successfully created.&lt;BR /&gt;NOTE: The data set WORK.ABC has 102660 observations and 10 variables.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.67 seconds&lt;BR /&gt;cpu time 0.57 seconds&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 18:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325761#M271463</guid>
      <dc:creator>starky987</dc:creator>
      <dc:date>2017-01-18T18:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325769#M271464</link>
      <description>&lt;P&gt;I would simply run that code with one modification (and removing the unnecessry lines if desired). i.e.,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data WORK.ABC ;
  infile 'E:\Research\Data\filename.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
  informat SOURCE $10. ;
  informat SYMBOL $4. ;
  informat TIMESTAMP_UTC e8601dz. ;
  informat BULLISH_INTENSITY best32. ;
  informat BEARISH_INTENSITY best32. ;
  informat BULL_MINUS_BEAR best32. ;
  informat BULL_SCORED_MESSAGES best32. ;
  informat BEAR_SCORED_MESSAGES best32. ;
  informat BULL_BEAR_MSG_RATIO best32. ;
  informat TOTAL_SCANNED_MESSAGES best32. ;
  format SOURCE $10. ;
  format SYMBOL $4. ;
  format TIMESTAMP_UTC datetime. ;
  format BULLISH_INTENSITY best12. ;
  format BEARISH_INTENSITY best12. ;
  format BULL_MINUS_BEAR best12. ;
  format BULL_SCORED_MESSAGES best12. ;
  format BEAR_SCORED_MESSAGES best12. ;
  format BULL_BEAR_MSG_RATIO best12. ;
  format TOTAL_SCANNED_MESSAGES best12. ;
  input
   SOURCE $
   SYMBOL $
   TIMESTAMP_UTC
   BULLISH_INTENSITY
   BEARISH_INTENSITY
   BULL_MINUS_BEAR
   BULL_SCORED_MESSAGES
   BEAR_SCORED_MESSAGES
   BULL_BEAR_MSG_RATIO
   TOTAL_SCANNED_MESSAGES
  ;
run;
&lt;/PRE&gt;
&lt;P&gt;You may have to change thee8601dz, informat to include the width and number of decimal places desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325769#M271464</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-18T19:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325816#M271465</link>
      <description>&lt;P&gt;That fixed it, thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2017 21:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/325816#M271465</guid>
      <dc:creator>starky987</dc:creator>
      <dc:date>2017-01-18T21:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/326216#M271466</link>
      <description>&lt;P&gt;Using the&lt;/P&gt;&lt;PRE&gt;e8601dz.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;informat causes the script to malfunction when there are blank timestamps:&lt;/P&gt;&lt;P&gt;NOTE: Invalid data for&lt;/P&gt;&lt;PRE&gt;TIMESTAMP_UTC&lt;/PRE&gt;&lt;P&gt;Is there any workaround for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 10:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/326216#M271466</guid>
      <dc:creator>user_</dc:creator>
      <dc:date>2017-01-20T10:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS won't import UTC time stamps from CSV file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/326276#M271467</link>
      <description>&lt;P&gt;Add 2 question marks after the variable is specified in the input statement. i.e.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;  input
   SOURCE $
   SYMBOL $
   TIMESTAMP_UTC ??
   BULLISH_INTENSITY
&lt;/PRE&gt;
&lt;P&gt;That will cause SAS to ignore the error, continue processing, and simply leave the variable with a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 14:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-UTC-time-stamps-from-CSV-file/m-p/326276#M271467</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-20T14:10:13Z</dc:date>
    </item>
  </channel>
</rss>

