<?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: Adding formatted dates with infile input in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664152#M22839</link>
    <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We need to use the colon to read the dates with an informat ddmmyy10. and display the date with format date9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
LENGTH character $60. ;
INFILE DATALINES DLM=','; 
INPUT character$ date:ddmmyy10.;
format date date9.;
DATALINES;
aaa,20/06/2020
b bb,21/06/2020
cc c,22/06/2020
;
RUN;&lt;/CODE&gt;&lt;/PRE&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>Tue, 23 Jun 2020 07:27:47 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2020-06-23T07:27:47Z</dc:date>
    <item>
      <title>Adding formatted dates with infile input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664151#M22838</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have data delimited with a comma, where dates are formatted in 23/06/2020 format. I want to add them to a sas table. Below is an example, could you please guide how should I do it to have the column 'date' formatted as date? it can be either ddmmyys10. or date9.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
LENGTH character $60. ;
INFILE DATALINES DLM=','; 
INPUT character $ date ddmmyys10.;
DATALINES;
aaa,20/06/2020
b bb,21/06/2020
cc c,22/06/2020
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jun 2020 07:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664151#M22838</guid>
      <dc:creator>cactooos</dc:creator>
      <dc:date>2020-06-23T07:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding formatted dates with infile input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664152#M22839</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We need to use the colon to read the dates with an informat ddmmyy10. and display the date with format date9.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
LENGTH character $60. ;
INFILE DATALINES DLM=','; 
INPUT character$ date:ddmmyy10.;
format date date9.;
DATALINES;
aaa,20/06/2020
b bb,21/06/2020
cc c,22/06/2020
;
RUN;&lt;/CODE&gt;&lt;/PRE&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>Tue, 23 Jun 2020 07:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664152#M22839</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-06-23T07:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding formatted dates with infile input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664161#M22840</link>
      <description>&lt;P&gt;You could use the informat-statement to assign the proper informat to the variable date prior to the input-statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
LENGTH character $60. date 8;
informat date ddmmyys10.;
format date date9.;
INFILE DATALINES DLM=','; 
INPUT character $ date;
DATALINES;
aaa,20/06/2020
b bb,21/06/2020
cc c,22/06/2020
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that it is highly recommended to assign a date-format to variables containing date-values.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 07:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664161#M22840</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-06-23T07:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adding formatted dates with infile input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664167#M22841</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile datalines dlm=',' dsd; 
input character :$60. date :ddmmyy10.;
format date ddmmyy10.;
datalines;
aaa,20/06/2020
b bb,21/06/2020
cc c,22/06/2020
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By using the colon modifier, you can set the length of the variables through the informat in the INPUT statement.&lt;/P&gt;
&lt;P&gt;Add the DSD option to correctly deal with two consecutive delimiters (missing values).&lt;/P&gt;
&lt;P&gt;A data step with DATALINES needs no RUN, as the DATALINES statement and the datalines block constitute the step boundary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;EM&gt;Edit: removed the unnecessary LENGTH statement.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 08:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664167#M22841</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-23T08:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding formatted dates with infile input</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664173#M22842</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;Thanks for fast response, it's working now&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 08:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Adding-formatted-dates-with-infile-input/m-p/664173#M22842</guid>
      <dc:creator>cactooos</dc:creator>
      <dc:date>2020-06-23T08:43:35Z</dc:date>
    </item>
  </channel>
</rss>

