<?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 convert a char variable to date in Forum em português</title>
    <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802362#M993</link>
    <description>&lt;P&gt;That second one is not valid style for the SAS informat because there is no colon in the offset time.&lt;/P&gt;
&lt;P&gt;You can stick in the colon and then the informat will work.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
  input id (data_upload_elsa calendar_date) (:$40.);
  dt1=input(data_upload_elsa,e8601dz25.);
  dt2=input(cats(substr(calendar_date,1,22),':',substr(calendar_date,23)),e8601dz25.);
  format dt: datetime24.3;
cards;
1 2017-05-04T18:15:47.717Z 2017-04-19T20:00:00-0300
2 2017-05-04T18:15:47.717Z 2017-04-20T20:00:00-0300
3 2017-05-04T18:15:47.717Z 2017-04-21T20:00:00-0300
4 2017-05-04T18:15:47.717Z 2017-04-22T20:00:00-0300
5 2017-05-04T18:15:47.717Z 2017-04-23T20:00:00-0300
6 2017-05-04T18:15:47.717Z 2017-04-24T20:00:00-0300
7 2017-05-04T18:15:47.717Z 2017-04-25T19:59:55-0300
8 2017-05-03T18:51:27.674Z 2017-04-20T20:00:00-0300
9 2017-05-03T18:51:27.674Z 2017-04-21T20:00:00-0300
10 2017-05-03T18:51:27.674Z 2017-04-22T20:00:00-0300
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 15 Mar 2022 22:38:01 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-03-15T22:38:01Z</dc:date>
    <item>
      <title>How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802332#M990</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to find you all well.&amp;nbsp;I have a .xlsx data file and using 'proc import' they are read in char format. The data in excel sheet are as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id data_upload_elsa calendar_date&lt;BR /&gt;1 2017-05-04T18:15:47.717Z 2017-04-19T20:00:00-0300&lt;BR /&gt;2 2017-05-04T18:15:47.717Z 2017-04-20T20:00:00-0300&lt;BR /&gt;3 2017-05-04T18:15:47.717Z 2017-04-21T20:00:00-0300&lt;BR /&gt;4 2017-05-04T18:15:47.717Z 2017-04-22T20:00:00-0300&lt;BR /&gt;5 2017-05-04T18:15:47.717Z 2017-04-23T20:00:00-0300&lt;BR /&gt;6 2017-05-04T18:15:47.717Z 2017-04-24T20:00:00-0300&lt;BR /&gt;7 2017-05-04T18:15:47.717Z 2017-04-25T19:59:55-0300&lt;BR /&gt;8 2017-05-03T18:51:27.674Z 2017-04-20T20:00:00-0300&lt;BR /&gt;9 2017-05-03T18:51:27.674Z 2017-04-21T20:00:00-0300&lt;BR /&gt;10 2017-05-03T18:51:27.674Z 2017-04-22T20:00:00-0300&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already tried importing using the statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data_upload = input(data_upload_elsa,datetime.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but without success.&amp;nbsp;I would be very grateful if anyone can suggest a way to convert these variables to the 'datetime' format.&lt;/P&gt;&lt;P&gt;Thank you all in advance.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Alvaro&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data_upload = input(data_upload_elsa,datetime.);&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 20:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802332#M990</guid>
      <dc:creator>Vigo</dc:creator>
      <dc:date>2022-03-15T20:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802335#M991</link>
      <description>&lt;P&gt;You have ISO8601 date so use proper informat:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p1a0qt18rxydrkn1b0rtdfh2t8zs.htm#p02ptihnnczk6qn1fdh9qjqin0sp" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p1a0qt18rxydrkn1b0rtdfh2t8zs.htm#p02ptihnnczk6qn1fdh9qjqin0sp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 20:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802335#M991</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-03-15T20:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802355#M992</link>
      <description>&lt;P&gt;Your code is mostly correct, you need to use a different informat. &lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt; has pointed you to the correct informat but linked you to the format not informat section: &lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p1a0qt18rxydrkn1b0rtdfh2t8zs.htm#p02ptihnnczk6qn1fdh9qjqin0sp" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p1a0qt18rxydrkn1b0rtdfh2t8zs.htm#p02ptihnnczk6qn1fdh9qjqin0sp&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You can also navigate the informats directly here and I think this is the format for both your variables&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p14nbxgmr6gn7tn1ntmuulgawrih.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/p14nbxgmr6gn7tn1ntmuulgawrih.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 22:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802355#M992</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-03-15T22:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802362#M993</link>
      <description>&lt;P&gt;That second one is not valid style for the SAS informat because there is no colon in the offset time.&lt;/P&gt;
&lt;P&gt;You can stick in the colon and then the informat will work.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
  input id (data_upload_elsa calendar_date) (:$40.);
  dt1=input(data_upload_elsa,e8601dz25.);
  dt2=input(cats(substr(calendar_date,1,22),':',substr(calendar_date,23)),e8601dz25.);
  format dt: datetime24.3;
cards;
1 2017-05-04T18:15:47.717Z 2017-04-19T20:00:00-0300
2 2017-05-04T18:15:47.717Z 2017-04-20T20:00:00-0300
3 2017-05-04T18:15:47.717Z 2017-04-21T20:00:00-0300
4 2017-05-04T18:15:47.717Z 2017-04-22T20:00:00-0300
5 2017-05-04T18:15:47.717Z 2017-04-23T20:00:00-0300
6 2017-05-04T18:15:47.717Z 2017-04-24T20:00:00-0300
7 2017-05-04T18:15:47.717Z 2017-04-25T19:59:55-0300
8 2017-05-03T18:51:27.674Z 2017-04-20T20:00:00-0300
9 2017-05-03T18:51:27.674Z 2017-04-21T20:00:00-0300
10 2017-05-03T18:51:27.674Z 2017-04-22T20:00:00-0300
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Mar 2022 22:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/802362#M993</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-15T22:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/803331#M996</link>
      <description>&lt;P&gt;Hello Tom,&lt;BR /&gt;Thank you very much for your time and willingness to help with this issue. I really appreciated your contribution.&lt;BR /&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/803331#M996</guid>
      <dc:creator>Vigo</dc:creator>
      <dc:date>2022-03-22T12:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a char variable to date</title>
      <link>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/803333#M997</link>
      <description>&lt;P&gt;Thank you all for your time and willingness to help with this issue. I really appreciated your contribution.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 13:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-em-portugu%C3%AAs/How-to-convert-a-char-variable-to-date/m-p/803333#M997</guid>
      <dc:creator>Vigo</dc:creator>
      <dc:date>2022-03-22T13:01:38Z</dc:date>
    </item>
  </channel>
</rss>

