<?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: Remove unnecessary delimiters when reading in text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665143#M198821</link>
    <description>&lt;P&gt;Here are some lines from my text file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Category|ID|PIN|First_Name|Middle_Name|Last_Name|BusName|Business_Ind
SP220|686|1003|John|R|Smith|ABC-Health Hospital|N|
SK220|786|1633|Steven|R|Smith|Health Clinic R US|N|
SV220|886|1653|Adam|R|Smith|HTP Business Depot|N|
SP220|12345|123456789|John|D|Doe|This is | A | Fake Business|N|
SE220|986|1513|Jane|R|Smith|Non-profit Center Campus|N|
SR220|286|11113|Jeremy|R|Smith|Heart &amp;amp; Health Center|N|&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 20:30:58 GMT</pubDate>
    <dc:creator>A_Swoosh</dc:creator>
    <dc:date>2020-06-25T20:30:58Z</dc:date>
    <item>
      <title>Remove unnecessary delimiters when reading in text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665137#M198817</link>
      <description>&lt;P&gt;Hello, I'm attempting to read in raw text files. The data is in text file format with pipe delimiters and the below is a subset example with not all variables listed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Category|ID|PIN|First_Name|Middle_Name|Last_Name|BusName|Business_Ind|
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I encounter situations in the middle of my data as follows:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SP220|12345|123456789|John|D|Doe|This is | A | Fake Business|N|&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From above, I can see that 'This is A Fake Business' should be the business name but since the delimiter is the same format as the rest, it keeps moving on to the next variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without manually making these changes, is there a way to correct this issue in SAS? Also, the next variable is likely to be a single letter (e.g. "N") after business name if that is any help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	    data raw_&amp;amp;file.0    ;
		    %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
		    infile  "&amp;amp;prov.\&amp;amp;provfile." delimiter = &amp;amp;dlm. dsd  missover  lrecl=32767 firstobs=1 ;
		       informat v1 -v200 $256. ;
		       format v1 -v200 $256. ;
		    input v1 -v200 @;
		run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jun 2020 19:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665137#M198817</guid>
      <dc:creator>A_Swoosh</dc:creator>
      <dc:date>2020-06-25T19:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove unnecessary delimiters when reading in text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665138#M198818</link>
      <description>Typically if the delimiter is also embedded in text the general protocol is to quote the entire field. Is that not happening in your file? Can you post some records from the exact text file - do not use Excel as an intermediary - it will not share the data correctly.</description>
      <pubDate>Thu, 25 Jun 2020 19:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665138#M198818</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-25T19:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Remove unnecessary delimiters when reading in text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665143#M198821</link>
      <description>&lt;P&gt;Here are some lines from my text file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Category|ID|PIN|First_Name|Middle_Name|Last_Name|BusName|Business_Ind
SP220|686|1003|John|R|Smith|ABC-Health Hospital|N|
SK220|786|1633|Steven|R|Smith|Health Clinic R US|N|
SV220|886|1653|Adam|R|Smith|HTP Business Depot|N|
SP220|12345|123456789|John|D|Doe|This is | A | Fake Business|N|
SE220|986|1513|Jane|R|Smith|Non-profit Center Campus|N|
SR220|286|11113|Jeremy|R|Smith|Heart &amp;amp; Health Center|N|&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 20:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665143#M198821</guid>
      <dc:creator>A_Swoosh</dc:creator>
      <dc:date>2020-06-25T20:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove unnecessary delimiters when reading in text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665155#M198830</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197542"&gt;@A_Swoosh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Here are some lines from my text file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Category|ID|PIN|First_Name|Middle_Name|Last_Name|BusName|Business_Ind
SP220|686|1003|John|R|Smith|ABC-Health Hospital|N
SK220|786|1633|Steven|R|Smith|Health Clinic R US|N
SV220|886|1653|Adam|R|Smith|HTP Business Depot|N
SP220|12345|123456789|John|D|Doe|This is | A | Fake Business|N
SE220|986|1513|Jane|R|Smith|Non-profit Center Campus|N
SR220|286|11113|Jeremy|R|Smith|Heart &amp;amp; Health Center|N&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INFILE magic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;100  data test;
101     infile cards dsd dlm='|';
102     input @;
103     _infile_ = transtrn(_infile_,' | ',' ');
104     input (v1-v8) (:$64.);
105     list;
106     cards;

RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
107        Category|ID|PIN|First_Name|Middle_Name|Last_Name|BusName|Business_Ind
108        SP220|686|1003|John|R|Smith|ABC-Health Hospital|N
109        SK220|786|1633|Steven|R|Smith|Health Clinic R US|N
110        SV220|886|1653|Adam|R|Smith|HTP Business Depot|N
111        SP220|12345|123456789|John|D|Doe|This is A Fake Business|N 76
112        SE220|986|1513|Jane|R|Smith|Non-profit Center Campus|N 76
113        SR220|286|11113|Jeremy|R|Smith|Heart &amp;amp; Health Center|N 76
NOTE: The data set WORK.TEST has 7 observations and 8 variables.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 722px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46675i56F55901BEBD5C4C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 20:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-unnecessary-delimiters-when-reading-in-text-file/m-p/665155#M198830</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-06-25T20:35:37Z</dc:date>
    </item>
  </channel>
</rss>

