<?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: readin raw data repeated block with an id in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258211#M49693</link>
    <description>&lt;P&gt;Generally it helps to post the log with code and error messages.&lt;/P&gt;
&lt;P&gt;Note that the first part of your input has read @ specific columns. But the loop doesn't do that. So with the formats on the input it forces reading at the columns the previous field ended. So you end up with the code trying to read the last character of the date a space and the first character of the code. Since the code is numeric an imbedded space is invalid to read. You can avoid that by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;'s suggestion of adding informat statements and leaving the formats off the input statements tranforming the code to list input OR add appropriate +n to shift the start column over to the start of the variable.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Mar 2016 14:39:05 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-03-22T14:39:05Z</dc:date>
    <item>
      <title>readin raw data repeated block with an id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258182#M49687</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to import raw data that has multiple observation in a single record. each records start with a identifyer variable. &amp;nbsp;the following example show the data with the sas code i am using. It works fine :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;raw data &amp;amp;colon;

1824 1,323.34 2,472.85
1943 1,908.34
2046 1,423.52 1,673.46 3,276.65
2063 2,345.34 2,452.45 3,523.52 2,983.01


data excedata;
infile mydat(excedata.txt)  missover;
input id sales : comma. @ ;
 do while (sales ne .);
   output;
   input sales : comma. @;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Howver &amp;nbsp;when I want to use the same coding strucutre for this data I got invalid message in my log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;182-04-7814 09FEB99 530 04MAY99 610 
302-57-5023 09FEB99 480 04MAY99 530 
123-89-8470 09FEB99 560 04MAY99 570 13JUL99 610 
152-64-0014 09FEB99 780 
813-63-7456 09FEB99 790  


&lt;BR /&gt;data satdat2;&lt;BR /&gt;infile mydat(satdata2.txt) missover ;&lt;BR /&gt;input ssn $11. @13 date date7. @21 code 3. @ ; &lt;BR /&gt; do while (code ne .);&lt;BR /&gt; output;&lt;BR /&gt; input date date7. code 3. @ ;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it says invalide data for code. &amp;nbsp;Any clue ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Skp&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 11:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258182#M49687</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-03-22T11:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: readin raw data repeated block with an id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258190#M49690</link>
      <description>&lt;P&gt;Notice that in your first program you have INPUT SALES : comma.&amp;nbsp;@; &amp;nbsp;the colon : is the key to using an INFORMAT in an input statement with LIST input. You could alternatively&amp;nbsp;use an&amp;nbsp;INFORMAT statement to associate the INFORMATS and just use variables names in the input statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat sales comma.;
input&amp;nbsp;sales @;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 12:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258190#M49690</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-22T12:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: readin raw data repeated block with an id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258211#M49693</link>
      <description>&lt;P&gt;Generally it helps to post the log with code and error messages.&lt;/P&gt;
&lt;P&gt;Note that the first part of your input has read @ specific columns. But the loop doesn't do that. So with the formats on the input it forces reading at the columns the previous field ended. So you end up with the code trying to read the last character of the date a space and the first character of the code. Since the code is numeric an imbedded space is invalid to read. You can avoid that by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__﻿&lt;/a&gt;'s suggestion of adding informat statements and leaving the formats off the input statements tranforming the code to list input OR add appropriate +n to shift the start column over to the start of the variable.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2016 14:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258211#M49693</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-22T14:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: readin raw data repeated block with an id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258393#M49751</link>
      <description>&lt;PRE&gt;
data have;
infile '/folders/myfolders/test.txt' truncover;
input ssn : $11.  date : date7.  code @ ;  
do while (code ne .); 
 output;
 input date : date7.  code @ ;
end;
format date  date7.;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 01:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258393#M49751</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-23T01:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: readin raw data repeated block with an id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258903#M49975</link>
      <description>&lt;P&gt;Thanks Ksharp !&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 18:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/readin-raw-data-repeated-block-with-an-id/m-p/258903#M49975</guid>
      <dc:creator>saskapa</dc:creator>
      <dc:date>2016-03-24T18:34:19Z</dc:date>
    </item>
  </channel>
</rss>

