<?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: to read different informats in the same dataline? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531290#M5884</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id  $  location $ date1 : anydtdte21.  gender $ DOB : anydtdte21.;
format date1 dob date9.;
cards;
001 pun 09-16-2010 male 04-28-1959
002 MUM 30MAY2010 F 15AUG1960
003 pun 08-18-2010 female 10-11-1961
004 MUM 12FEB2011 M 29APR1962
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Jan 2019 08:38:35 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-01-30T08:38:35Z</dc:date>
    <item>
      <title>to read different informats in the same dataline?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531285#M5880</link>
      <description>&lt;P&gt;Hi all;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This text contains data on id, location ,date1, gender and dob, but dates in different formats. also the length of gender is different. how can i read this dataset using 'infile'?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp; location date1&amp;nbsp; gender DOB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;001 pun 09-16-2010 male 04-28-1959&lt;BR /&gt;002 MUM 30MAY2010 F 15AUG1960&lt;BR /&gt;003 pun 08-18-2010 female 10-11-1961&lt;BR /&gt;004 MUM 12FEB2011 M 29APR1962&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please answer the question.&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 08:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531285#M5880</guid>
      <dc:creator>AKHILA</dc:creator>
      <dc:date>2019-01-30T08:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: to read different informats in the same dataline?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531289#M5883</link>
      <description>&lt;P&gt;Read into character variables, and convert:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input id :$3. location :$3. _date1 :$10. _gender $ _DOB :$10.;
format
  date1 yymmddd10.
  gender $1.
  DOB yymmddd10.
;
date1 = ifn(length(_date1) = 10,input(_date1,mmddyy10.),input(_date1,date9.));
gender = upcase(substr(_gender,1,1));
DOB = ifn(length(_DOB) = 10,input(_DOB,mmddyy10.),input(_DOB,date9.));
drop _:;
cards;
001 pun 09-16-2010 male 04-28-1959
002 MUM 30MAY2010 F 15AUG1960
003 pun 08-18-2010 female 10-11-1961
004 MUM 12FEB2011 M 29APR1962
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jan 2019 08:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531289#M5883</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-30T08:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: to read different informats in the same dataline?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531290#M5884</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id  $  location $ date1 : anydtdte21.  gender $ DOB : anydtdte21.;
format date1 dob date9.;
cards;
001 pun 09-16-2010 male 04-28-1959
002 MUM 30MAY2010 F 15AUG1960
003 pun 08-18-2010 female 10-11-1961
004 MUM 12FEB2011 M 29APR1962
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jan 2019 08:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531290#M5884</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-30T08:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: to read different informats in the same dataline?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531292#M5885</link>
      <description>&lt;P&gt;I would advise against the use of the "any" informats, because of things like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id  $  location $ date1 : anydtdte21.  gender $ DOB : anydtdte21.;
format date1 dob date9.;
cards;
001 pun 09-16-2010 male 04-28-1959
002 MUM 12-03-2018 M 11-03-1972
;
run;

proc print data=have noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;id     location        date1    gender          DOB

001      pun       16SEP2010     male     28APR1959
002      MUM       12MAR2018     M        11MAR1972
&lt;/PRE&gt;
&lt;P&gt;Depending on local settings, the outcome of ambiguous month/day values may be unexpected. Much better to be strict.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 08:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/to-read-different-informats-in-the-same-dataline/m-p/531292#M5885</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-30T08:49:27Z</dc:date>
    </item>
  </channel>
</rss>

