<?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 how to read in really messy data like this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38753#M7806</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a raw data like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;649519BU8 12/15/2021 100 12/15/2022 100 12/15/2023 100 12/15/2024 100 12/15/2025 100 &lt;/P&gt;&lt;P&gt;519Bw852 12/15/2026 100 12/15/2027 100 12/15/2028 100 12/15/2029 100 12/15/2030&lt;/P&gt;&lt;P&gt;X028W71659 11/19/2011 3/9/2012 3/9/2022 12/15/2005 4/8/2008 &lt;/P&gt;&lt;P&gt;D7P00A1 12/15/2031 70 12/15/2032 60 12/15/2033 74 12/15/2034 68 12/15/2035 68 12/15/2036 75&lt;/P&gt;&lt;P&gt;DE000A1GNAH1 7/8/2021 80 10/8/2021 70 1/8/2022 100 4/8/2022 60 7/8/2022 80 10/8/2022 &lt;/P&gt;&lt;P&gt;XS0271265299 10/19/2011 1/8/2022 4/8/2022 12/15/2025 4/8/2023 &lt;/P&gt;&lt;P&gt;804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029 . 12/15/2030&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to read them into sas file into 3 colums&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Price&lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2021&amp;nbsp; 100&amp;nbsp; &lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2022&amp;nbsp; 100 &lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2023&amp;nbsp; 100 &lt;/P&gt;&lt;P&gt;D7P00A1&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/15/2031&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.7 &lt;/P&gt;&lt;P&gt;D7P00A1&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/15/2032&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.6&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 10/19/2011&amp;nbsp; .&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 1/8/2022&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 4/8/2022&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This challenge is the price column in the raw data file is not fixed, &lt;/P&gt;&lt;P&gt;some times it have price like 1st, 2nd row &lt;/P&gt;&lt;P&gt;some times it does not have price, like 3rd row (X028W71659 row)&lt;/P&gt;&lt;P&gt;some times it is a percentage like 4th row (D7P00A1 row), it is 70%, or 0.7, so basically any value less than 90 is a percentage, not a price&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each row, in the end, they are not fixed columns/ length or any sort.&lt;/P&gt;&lt;P&gt;so, how do I read them in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Mar 2012 03:39:56 GMT</pubDate>
    <dc:creator>ZRick</dc:creator>
    <dc:date>2012-03-21T03:39:56Z</dc:date>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38753#M7806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a raw data like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;649519BU8 12/15/2021 100 12/15/2022 100 12/15/2023 100 12/15/2024 100 12/15/2025 100 &lt;/P&gt;&lt;P&gt;519Bw852 12/15/2026 100 12/15/2027 100 12/15/2028 100 12/15/2029 100 12/15/2030&lt;/P&gt;&lt;P&gt;X028W71659 11/19/2011 3/9/2012 3/9/2022 12/15/2005 4/8/2008 &lt;/P&gt;&lt;P&gt;D7P00A1 12/15/2031 70 12/15/2032 60 12/15/2033 74 12/15/2034 68 12/15/2035 68 12/15/2036 75&lt;/P&gt;&lt;P&gt;DE000A1GNAH1 7/8/2021 80 10/8/2021 70 1/8/2022 100 4/8/2022 60 7/8/2022 80 10/8/2022 &lt;/P&gt;&lt;P&gt;XS0271265299 10/19/2011 1/8/2022 4/8/2022 12/15/2025 4/8/2023 &lt;/P&gt;&lt;P&gt;804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029 . 12/15/2030&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to read them into sas file into 3 colums&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Price&lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2021&amp;nbsp; 100&amp;nbsp; &lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2022&amp;nbsp; 100 &lt;/P&gt;&lt;P&gt;649519BU8&amp;nbsp; 12/15/2023&amp;nbsp; 100 &lt;/P&gt;&lt;P&gt;D7P00A1&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/15/2031&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.7 &lt;/P&gt;&lt;P&gt;D7P00A1&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/15/2032&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.6&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 10/19/2011&amp;nbsp; .&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 1/8/2022&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;XS0271265299&amp;nbsp; 4/8/2022&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This challenge is the price column in the raw data file is not fixed, &lt;/P&gt;&lt;P&gt;some times it have price like 1st, 2nd row &lt;/P&gt;&lt;P&gt;some times it does not have price, like 3rd row (X028W71659 row)&lt;/P&gt;&lt;P&gt;some times it is a percentage like 4th row (D7P00A1 row), it is 70%, or 0.7, so basically any value less than 90 is a percentage, not a price&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each row, in the end, they are not fixed columns/ length or any sort.&lt;/P&gt;&lt;P&gt;so, how do I read them in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 03:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38753#M7806</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-21T03:39:56Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38754#M7807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Very Tough i guess.&lt;/P&gt;&lt;P&gt;Not sure whether it is possible or not as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38754#M7807</guid>
      <dc:creator>manojinpec</dc:creator>
      <dc:date>2012-03-21T09:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38755#M7808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ZRick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just try this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename mydata "path to data\data.txt";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mydata(drop=row i);&lt;BR /&gt;length ID $20 Date $15 Price 8;&lt;BR /&gt;infile mydata truncover lrecl=256;&lt;BR /&gt;input @1 row $256.;&lt;BR /&gt;ID = scan(row,1,' ');&lt;BR /&gt;i=2;&lt;BR /&gt;do while (Date ne '' or i=2);&lt;BR /&gt;Date = scan(row,i,' ');&lt;BR /&gt;if index(scan(row,i+1,' '),'/') then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Price = .;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1;&lt;BR /&gt;end;&lt;BR /&gt;else do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Price = input(scan(row,i+1,' '),12.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Price &amp;lt; 90 then Price = Price / 100;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 2;&lt;BR /&gt;end;&lt;BR /&gt;if Date ne '' then output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just remember that the parameter "lrecl=256" should be as long or longer than the longest row and the informat to variable "row" should be as long as this parameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38755#M7808</guid>
      <dc:creator>SR71Blackbird</dc:creator>
      <dc:date>2012-03-21T09:07:53Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38756#M7809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here am seeing one of the column ID is Alphanumeric and even the length of ID also not fixed. Please confirm the length of Id once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;S Ravuri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38756#M7809</guid>
      <dc:creator>sambasiva_ravuri_tcs_com</dc:creator>
      <dc:date>2012-03-21T09:11:21Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38757#M7810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data x(drop=x);
infile cards truncover;
length x $ 3;
input id : $20. @;
do until(missing(x));
input date : mmddyy12. @ ;
input x&amp;nbsp; $char3. +(-3)&amp;nbsp; @;&amp;nbsp; 
if not missing(x) or not missing(date) then do;
if index(x,'/') then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=.;output;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
 else do; input&amp;nbsp; price&amp;nbsp; @; output;end;
end;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; 
format date mmddyy10.;
cards; 
649519BU8 12/15/2021 100 12/15/2022 100 12/15/2023 100 12/15/2024 100 12/15/2025 100
519Bw852 12/15/2026 100 12/15/2027 100 12/15/2028 100 12/15/2029 100 12/15/2030
X028W71659 11/19/2011 3/9/2012 3/9/2022 12/15/2005 4/8/2008
D7P00A1 12/15/2031 70 12/15/2032 60 12/15/2033 74 12/15/2034 68 12/15/2035 68 12/15/2036 75
DE000A1GNAH1 7/8/2021 80 10/8/2021 70 1/8/2022 100 4/8/2022 60 7/8/2022 80 10/8/2022
XS0271265299 10/19/2011 1/8/2022 4/8/2022 12/15/2025 4/8/2023
804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029 . 12/15/2030
;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38757#M7810</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-21T09:25:15Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38758#M7811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Opps.&lt;/P&gt;&lt;P&gt;You also need another data step to transform the price which less than 70 into percent 0.7. That is very easy for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38758#M7811</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-21T09:28:02Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38759#M7812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I don't think Mainframe SAS won't support more than 80 characters length of Input, eventhough we put lrecl parameter. Please confirm ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;S Rvauri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38759#M7812</guid>
      <dc:creator>sambasiva_ravuri_tcs_com</dc:creator>
      <dc:date>2012-03-21T09:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38760#M7813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello S Rvauri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for SAS programs as member in a PDS-file you have to use 80 chars of length, but for simple data in a flatfile you can use much more, I think about 32000 or so. Just try to allocate an extra file for the data on z/OS. &lt;/P&gt;&lt;P&gt;So "infile cards" won't be the preferred way, you should reference an external flat file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38760#M7813</guid>
      <dc:creator>SR71Blackbird</dc:creator>
      <dc:date>2012-03-21T09:48:37Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38761#M7814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi SR71Blackbird,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with you. We are not suppose to use Infile cards and this is possible only for external flat file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;S Ravuri.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2012 09:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38761#M7814</guid>
      <dc:creator>sambasiva_ravuri_tcs_com</dc:creator>
      <dc:date>2012-03-21T09:51:29Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38762#M7815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I optimized my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data x(drop=x );
infile cards truncover;
length x $ 12;
input id : $20. @;
do until(missing(x));
input date : mmddyy12. @ ;
input x : $char12.&amp;nbsp; +(-1*(length(x)+1)) @; 
if not missing(x) or not missing(date) then do;
if index(x,'/') then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=.;output;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
 else do; input&amp;nbsp; price&amp;nbsp; @; output;end; 
end;
end;
format date mmddyy10.;
cards; 
649519BU8 12/15/2021 100 12/15/2022 100 12/15/2023 100 12/15/2024 100 12/15/2025 100
519Bw852 12/15/2026 100 12/15/2027 100 12/15/2028 100 12/15/2029 100 12/15/2030
X028W71659 11/19/2011 3/9/2012 3/9/2022 12/15/2005 4/8/2008
D7P00A1 12/15/2031 70 12/15/2032 60 12/15/2033 74 12/15/2034 68 12/15/2035 68 12/15/2036 75
DE000A1GNAH1 7/8/2021 80 10/8/2021 70 1/8/2022 100 4/8/2022 60 7/8/2022 80 10/8/2022
XS0271265299 10/19/2011 1/8/2022 4/8/2022 12/15/2025 4/8/2023
804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029 . 12/15/2030
;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 02:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38762#M7815</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-22T02:15:59Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38763#M7816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;really nice code, thank you so much, Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 04:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38763#M7816</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-22T04:49:27Z</dc:date>
    </item>
    <item>
      <title>how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38764#M7817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://communities.sas.com/people/SR71Blackbird" id="jive-911032893489375319803"&gt;SR71Blackbird&lt;/A&gt;'s code ?&lt;/P&gt;&lt;P&gt;I also want to know the result of running his code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Mar 2012 08:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38764#M7817</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-22T08:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38765#M7818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tested both codes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp, I think your code has some issue, it didn't read in correctly. for records: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DE000A1GNAH1, 10/08/2022, data has&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt; XS0271265299, 04/08/2023, data has&amp;nbsp; 3, &lt;/P&gt;&lt;P&gt;904510KN3, 12/15/2030, data has 30&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all 2, 3, 30 should not be there. Here is your code, I change it little bit to make it read in txt file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Ksharp_x(drop=x );&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile mydata truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length x $ 12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id : $20. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(missing(x));&lt;/P&gt;&lt;P&gt;&amp;nbsp; input date : mmddyy12. @ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x : $char12.&amp;nbsp; +(-1*(length(x)+1)) @; &lt;/P&gt;&lt;P&gt;&amp;nbsp; if not missing(x) or not missing(date) then &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if index(x,'/') then &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&amp;nbsp; price&amp;nbsp; @; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; &lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SR71Blackbird, read all data correctly. &lt;/P&gt;&lt;P&gt;Ksharp, can you help fix it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 14:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38765#M7818</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-03-23T14:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38766#M7819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp; SR71Blackbird,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the row is extremely larger than we can imaged(not just hundres,maby millons or more rows),How about read that into a hash object before the result output to a table? &lt;/P&gt;&lt;P&gt;George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 16:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38766#M7819</guid>
      <dc:creator>George_S</dc:creator>
      <dc:date>2012-03-23T16:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38767#M7820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. But these data doesn't look like what you firstly post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data x(drop=x );
infile cards truncover dlm=',';
length x price $ 20;
input id : $20. @;
do until(missing(x));
input date : mmddyy12. @ ;
input x $char20.&amp;nbsp; +(-1*(lengthc(x)+1)) @; 
if not missing(x) or not missing(date) then do;
if index(x,'/') then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=' ';output;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
 else do; input&amp;nbsp; price $ @; output;end; 
end;
end;
format date mmddyy10.;
cards; 
DE000A1GNAH1, 10/08/2022, data has&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
XS0271265299, 04/08/2023, data has&amp;nbsp; 3,
904510KN3, 12/15/2030, data has 30
;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;消息编辑者为：xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Mar 2012 12:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38767#M7820</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-24T12:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to read in really messy data like this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38768#M7821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029 . 12/15/2030&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replaced by &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;804519KN3 12/15/2026 99 12/15/2027 100 . 100 12/15/2029&amp;nbsp; 12/15/2030 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the result is same&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 15:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-read-in-really-messy-data-like-this/m-p/38768#M7821</guid>
      <dc:creator>George_S</dc:creator>
      <dc:date>2012-03-29T15:17:48Z</dc:date>
    </item>
  </channel>
</rss>

