<?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: reading pipe delimited file with multiple record layouts in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489254#M127708</link>
    <description>&lt;P&gt;Just guessing, since you didn't post any sample data, but you probably will want to read those delimited lists into character variables. You can then use the SCAN() function to pick out the individual values within the delimited lists.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile indd1 dsd dlm='|' truncover;
length reqtype $15 requser $9 reqid $9 phone $9 ssn $9 preferid $7
  first mi last bank ccenter email mailcode fill1 fill2 taskid $36
  assignee hostplat hostfill prior date1 date2 action userid sapid
  modelid modelnm deldes_list addess_list $600
;
input reqtype -- address_list;
array deldes (14)  $100;
array address (14) $100 ;
do  i=1 to dim(deldes);
  deldes(i)=scan(deldes_list,i,'?');
end;
do  i=1 to dim(address);
  address(i)=scan(address_list,i,'?');
end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your length statement looks a little funky.&amp;nbsp; Do the all of the last 13 variables really need to be defined with a length of 600?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like you posted some sample records.&amp;nbsp; They all look like they have an empty first field since they all start with a pipe character in the first position.&amp;nbsp; You might need to add another variable to your INPUT statement to account for that.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 13:27:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-08-23T13:27:22Z</dc:date>
    <item>
      <title>reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489238#M127696</link>
      <description>&lt;P&gt;I am new to SAS programming.&amp;nbsp;&amp;nbsp; so what I have is a file using a pipe "|" delimiter, but it has 2 fields that use a secondary delimiter of "?" for data that can contain from 1 to 14 entries for each field.&amp;nbsp;&amp;nbsp; Have it currently set up as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;INFILE INDD1 COL=COL PAD LENGTH=LENGTH MISSOVER DELIMITER='|' dsd;
INPUT @1 LINE $VARYING. LENGTH @;                                 
LENGTH REQTYPE $15 REQUSER $9 REQID $9 PHONE $9 SSN $9 PREFERID $7
FIRST MI LAST BANK CCENTER EMAIL MAILCODE FILL1 FILL2 TASKID $36  
ASSIGNEE HOSTPLAT HOSTFILL PRIOR DATE1 DATE2 ACTION USERID SAPID  
MODELID MODELNM DELDES ADDESS $600;    &lt;/CODE&gt;&lt;/PRE&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;&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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the fields DELDES &amp;amp; ADDESS are the fields that use the secondary delimiter of ? inside of the.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I define and use the individual fields within DELDES &amp;amp; ADDESS ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry if this is hard to read, I'm an old COBOL developer and this is my first post;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;examples of data&lt;/P&gt;&lt;P&gt;example 1:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;Byte ----+----10---+----2----+----3----+----4----+----5----+----6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;&amp;nbsp; 1 |Delete|NODATA|NODATA|1012404|noSSN|BLMORRO|BRITTNEY|X|MORRO&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; 61 W|bank|0004213|BRITTNEY.xxxxxxxxxxxxx.COM|SL-KS-S4FD|||72b02&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;121 7d9-5e2a-4b2e-8574-8871c2503766|TAOKES1|F400 TOPS PROCESS CO&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;181 NTROL|F400 TOPS PROCESS CONTROL|priority|TUE AUG 14 18:42:17&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;241&amp;nbsp; CDT 2018|TUE AUG 14 18:42:17 CDT 2018|Delete|BLMORRO||||INT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;301 ERNAL TABLE: RFS|||||&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example 2:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;Byte ----+----10---+----2----+----3----+----4----+----5----+----6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;&amp;nbsp; 1 |Add|NODATA|NODATA|1004604|noSSN|DGTHOM2|DONALD|X|THOMAS|ban&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; 61 k|0005182|DONALD.xxxxxxxxxxxxx.COM|EP-MN-WS4M|||ee497752-8a8&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;121 2-479a-a206-9395c84b32e5|TAOKES1|F400 TOPS PROCESS CONTROL|F&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;181 400 TOPS PROCESS CONTROL|priority|TUE AUG 14 11:57:50 CDT 20&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;241 18|TUE AUG 14 11:57:50 CDT 2018|Add|DGTHOM2|||||OFFICE: OPS|&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;301 |||&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&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;&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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example 3:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;Byte ----+----10---+----2----+----3----+----4----+----5----+----6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;&amp;nbsp; 1 |Change|NODATA|NODATA|1001783|noSSN|TMDOORN|TIMOTHY|X|DOORN|&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; 61 bank|0022410|TIMOTHY.xxxxxxxxxxxK.COM|SL-KS-S1FD|||5e3e7038-&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;121 b315-4809-8b5c-a03091dbd7e3|TAOKES1|F400 TOPS PROCESS CONTRO&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;181 L|F400 TOPS PROCESS CONTROL|priority|TUE AUG 14 10:12:53 CDT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;241&amp;nbsp; 2018|TUE AUG 14 10:12:53 CDT 2018|Change|TMDOORN||||INTERNA&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;301 L TABLE: CBO?INTERNAL TABLE: CRV|INTERNAL TABLE: RFS||||&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example 4:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;Byte ----+----10---+----2----+----3----+----4----+----5----+----6&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;&amp;nbsp; 1 |Add|NODATA|NODATA|993332|noSSN|SLHEND7|SUNNY|X|HENDRIX|bank&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp; 61 |0052065|SUNNY.xxxxxxxxxxxxxx.COM|SL-KS-9211|||f5e697ec-61e7&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;121 -427f-ac00-68e24260e207|TAOKES1|F400 TOPS PROCESS CONTROL|F4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;181 00 TOPS PROCESS CONTROL|priority|MON AUG 13 13:43:05 CDT 201&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;241 8|MON AUG 13 13:43:05 CDT 2018|Add|SLHEND7|||||INTERNAL TABL&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="3"&gt;&amp;nbsp;301 E: RBS?OFFICE: CMNT||||&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="3"&gt;When I look at it in&amp;nbsp;excel, this is what I see&amp;nbsp; &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example data as seen in Excel" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22702iBEA859EA56AFC60E/image-size/large?v=v2&amp;amp;px=999" role="button" title="example in excel.png" alt="example data as seen in Excel" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;example data as seen in Excel&lt;/span&gt;&lt;/span&gt;&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;&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;&lt;/FONT&gt;&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;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489238#M127696</guid>
      <dc:creator>TAOKES1</dc:creator>
      <dc:date>2018-08-23T13:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489243#M127700</link>
      <description>&lt;P&gt;Please stop coding in all-uppercase, it's very hard to read. Especially given that you posted one piece of spaghetti code without any visual separations of functional blocks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the "little running man" symbol for posting code, and show us some examples for the source data. Post that with the {i} button, so that its contents and formatting remain unchanged.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 12:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489243#M127700</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-23T12:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489246#M127702</link>
      <description>&lt;P&gt;Don't write code all in upper case or mixed case, it is very hard to read, and use code window (its the {i} above post area) to post code.&amp;nbsp; I can't see any test data here, so just going to guess.&amp;nbsp; You can have more than one delimiter:&lt;/P&gt;
&lt;PRE&gt;...delimiter='&lt;SPAN&gt;|?'...&lt;BR /&gt;input reqtype $ requser $ ...;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;With that each part should be read in.&amp;nbsp; It may just be that simple to get it working.&amp;nbsp; If not, post a snippet of the data.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489246#M127702</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-23T13:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489254#M127708</link>
      <description>&lt;P&gt;Just guessing, since you didn't post any sample data, but you probably will want to read those delimited lists into character variables. You can then use the SCAN() function to pick out the individual values within the delimited lists.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile indd1 dsd dlm='|' truncover;
length reqtype $15 requser $9 reqid $9 phone $9 ssn $9 preferid $7
  first mi last bank ccenter email mailcode fill1 fill2 taskid $36
  assignee hostplat hostfill prior date1 date2 action userid sapid
  modelid modelnm deldes_list addess_list $600
;
input reqtype -- address_list;
array deldes (14)  $100;
array address (14) $100 ;
do  i=1 to dim(deldes);
  deldes(i)=scan(deldes_list,i,'?');
end;
do  i=1 to dim(address);
  address(i)=scan(address_list,i,'?');
end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your length statement looks a little funky.&amp;nbsp; Do the all of the last 13 variables really need to be defined with a length of 600?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like you posted some sample records.&amp;nbsp; They all look like they have an empty first field since they all start with a pipe character in the first position.&amp;nbsp; You might need to add another variable to your INPUT statement to account for that.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489254#M127708</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-23T13:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489262#M127712</link>
      <description>&lt;P&gt;Check termstr= option of INFILE statement .&lt;/P&gt;
&lt;P&gt;And open this file via NotePad++&amp;nbsp; and click 'show all characters' button at the top of panel.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489262#M127712</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-08-23T13:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489265#M127713</link>
      <description>confused with this, I am writing this on mainframe. sorry I am very much an old dinosaur. I am borrowing code and trying to make it fit mine.</description>
      <pubDate>Thu, 23 Aug 2018 13:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489265#M127713</guid>
      <dc:creator>TAOKES1</dc:creator>
      <dc:date>2018-08-23T13:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489266#M127714</link>
      <description>trying this now, thank you! I have posted data now. I am also adjusting field lengths</description>
      <pubDate>Thu, 23 Aug 2018 13:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489266#M127714</guid>
      <dc:creator>TAOKES1</dc:creator>
      <dc:date>2018-08-23T13:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489267#M127715</link>
      <description>&lt;P&gt;You should not have to worry about TERMSTR on a mainframe. The OS will take care to send SAS the records one by one.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489267#M127715</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-23T13:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: reading pipe delimited file with multiple record layouts</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489268#M127716</link>
      <description>thank you, sorry working on mainframe, and old cobol coder, used to doing things in all caps. I have adjusted the info above</description>
      <pubDate>Thu, 23 Aug 2018 13:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-pipe-delimited-file-with-multiple-record-layouts/m-p/489268#M127716</guid>
      <dc:creator>TAOKES1</dc:creator>
      <dc:date>2018-08-23T13:38:18Z</dc:date>
    </item>
  </channel>
</rss>

