<?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: How to read this specific datetime and then format? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/503290#M801</link>
    <description>&lt;P&gt;Thank you very much for the pieces of code. I do not know why I was getting error. However, using the same knowledge I later managed to get the desired outcome. My codes are the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data Huf; 
set Huf1;
 DT=DHMS(Input(Scan(Gmt_time,1,''),DDMMYY10.),Scan(Scan(Gmt_time,2,''),1,':'),Scan(Scan(Gmt_time,2,''),2,':'),Scan(Scan(Gmt_time,2,''),3,':'));
  Format DT DateTime19.;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Oct 2018 01:23:12 GMT</pubDate>
    <dc:creator>d6k5d3</dc:creator>
    <dc:date>2018-10-11T01:23:12Z</dc:date>
    <item>
      <title>How to read this specific datetime and then format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502968#M746</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appreciate the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make SAS read data from an imported file (.csv) having a column GMT_Time, and it appears as (for example):&amp;nbsp;13.03.2007 00:00:00.000.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen the log file. If I set getnames = yes, the cells in column is read (informat) as&amp;nbsp;ddmmyy10., and formatted as&amp;nbsp;ddmmyy10.! However, if I set getnames=no, the cells are read (informat) as VAR1 $23. and formatted as VAR1 $23.. Neither serves my purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want SAS to format them in a datetime format so that later I can perform date and time related calculations on SAS. I cannot figure out how to solve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you please tell me what should be my informat, format and input statements be? I would copy the code from log after PROC IMPORT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 03:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502968#M746</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-10T03:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this specific datetime and then format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502976#M749</link>
      <description>&lt;P&gt;This conversion method would work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
dtStr = "13.03.2007 00:00:00.000";
substr(dtStr,3,1) = "-";
substr(dtStr,6,1) = "-";
dt = input(dtStr, anydtdtm23.);
format dt datetime23.;
put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it replaces the periods in the date with hyphens and uses the anydtdtm. informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 04:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502976#M749</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-10T04:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this specific datetime and then format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502986#M750</link>
      <description>&lt;P&gt;PG, thank you very much for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have more than a million rows of data, and I wanted to import and format the variables by copying from the log file after PROC IMPORT. Is there a way to do the same thing just by altering some codes from the following log file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.HUF1 ;&lt;BR /&gt;%let _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;infile 'C:\Users\Deepan\OneDrive\xyz.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;&lt;BR /&gt;informat Gmt_time informat. ;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;format Gmt_time informat. ;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;input Gmt_time;&lt;/P&gt;&lt;P&gt;if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wholeheartedly appreciate your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 06:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502986#M750</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-10T06:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this specific datetime and then format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502992#M752</link>
      <description>&lt;P&gt;Use an intermediate variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat _gmt_time $23.;
format gmt_time e8601dt23.3;
input _gmt_time;
gmt_time = dhms(input(scan(_gmt_time,1),ddmmyy10.),0,0,input(scan(_gmt_time,2)time12.3));
drop _gmt_time;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Oct 2018 06:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/502992#M752</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-10T06:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this specific datetime and then format?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/503290#M801</link>
      <description>&lt;P&gt;Thank you very much for the pieces of code. I do not know why I was getting error. However, using the same knowledge I later managed to get the desired outcome. My codes are the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data Huf; 
set Huf1;
 DT=DHMS(Input(Scan(Gmt_time,1,''),DDMMYY10.),Scan(Scan(Gmt_time,2,''),1,':'),Scan(Scan(Gmt_time,2,''),2,':'),Scan(Scan(Gmt_time,2,''),3,':'));
  Format DT DateTime19.;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 01:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-this-specific-datetime-and-then-format/m-p/503290#M801</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-11T01:23:12Z</dc:date>
    </item>
  </channel>
</rss>

