<?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 import a txt file with multiple delimiters? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/596553#M15965</link>
    <description>&lt;P&gt;I'm trying to import a text file that has been extracted from a MUMPS database. However, it is both comma delimited and caret delimited. See example below. Can anyone tell me how to import this type of file?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^MUC("TXHAMMS",40622,733614)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS",40622,733853)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS",40622,734148)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS2",36708,711017)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,728648)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,731084)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,731869)&lt;BR /&gt;200^200^^^^^^^200^^^^^^^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,732348)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,732351)&lt;BR /&gt;200^200^^^^^^^200^^^^^^^200^200^200^200^200^200^200^200^200^^&lt;BR /&gt;^MUC("TXHAMMS2A",34903,733584)&lt;BR /&gt;200^^200^200^^200^200^^200^200^^200&lt;BR /&gt;^MUC("TXHAMMS2A",34903,733586)&lt;BR /&gt;200^^200^200^^200^200^^200^200^^200&lt;BR /&gt;^MUC("TXHBZLC",40884,719357)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719358)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719425)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719426)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2019 15:02:39 GMT</pubDate>
    <dc:creator>ashhazard</dc:creator>
    <dc:date>2019-10-15T15:02:39Z</dc:date>
    <item>
      <title>How to import a txt file with multiple delimiters?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/596553#M15965</link>
      <description>&lt;P&gt;I'm trying to import a text file that has been extracted from a MUMPS database. However, it is both comma delimited and caret delimited. See example below. Can anyone tell me how to import this type of file?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^MUC("TXHAMMS",40622,733614)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS",40622,733853)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS",40622,734148)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;BR /&gt;^MUC("TXHAMMS2",36708,711017)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,728648)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,731084)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,731869)&lt;BR /&gt;200^200^^^^^^^200^^^^^^^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,732348)&lt;BR /&gt;200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200&lt;BR /&gt;^MUC("TXHAMMS2",36708,732351)&lt;BR /&gt;200^200^^^^^^^200^^^^^^^200^200^200^200^200^200^200^200^200^^&lt;BR /&gt;^MUC("TXHAMMS2A",34903,733584)&lt;BR /&gt;200^^200^200^^200^200^^200^200^^200&lt;BR /&gt;^MUC("TXHAMMS2A",34903,733586)&lt;BR /&gt;200^^200^200^^200^200^^200^200^^200&lt;BR /&gt;^MUC("TXHBZLC",40884,719357)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719358)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719425)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;BR /&gt;^MUC("TXHBZLC",40884,719426)&lt;BR /&gt;100^100^100^100^100^100^100^100^100^100^^100^100^100^100^100^100^100^100^100^^^^100^100^100^100^100^^100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 15:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/596553#M15965</guid>
      <dc:creator>ashhazard</dc:creator>
      <dc:date>2019-10-15T15:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a txt file with multiple delimiters?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/596689#M15986</link>
      <description>&lt;P&gt;You can define more than one character as delimiter. As long as a delimiting character can't also be a valid character in another string, things will be rather simple.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  infile datalines truncover dlm='^,()' dsd;
  input (var1-var5) (:$20.);
  datalines;
^MUC("TXHAMMS2",36708,728648)
;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 295px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33153i7ABF03FFA40BF5B0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 23:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/596689#M15986</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-15T23:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a txt file with multiple delimiters?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/597753#M16188</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This does work except for one issue - all the variable for one observation are not on the same row. For example, the below is one observation and all the variables should be on the same row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^MUC("TXHAMMS",40622,733614)&lt;BR /&gt;300^300^300^300^300^300^300^300^300^300&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the data I'm importing all of the rows that end with a ")" are where the next row of variables are apart of the same observation. Is it possible to incorporate that?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 15:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/597753#M16188</guid>
      <dc:creator>ashhazard</dc:creator>
      <dc:date>2019-10-18T15:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to import a txt file with multiple delimiters?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/597854#M16209</link>
      <description>&lt;P&gt;If the sample you've posted is representative of your real data then the input statement could be as simple as below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
  infile datalines truncover dlm='^,()' dsd;
      input 
        #1 @2 (line1Var1-line1Var4) (:$20.) 
        #2 @1 (line2Var1-line2Var50) (:best32.)
        ; 
  datalines;
^MUC("TXHAMMS",40622,733614)
300^300^300^300^300^300^300^300^300^300
^MUC("TXHAMMS",40622,733853)
300^300^300^300^300^300^300^300^300^300
^MUC("TXHAMMS",40622,734148)
300^300^300^300^300^300^300^300^300^300
^MUC("TXHAMMS2",36708,711017)
200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200
^MUC("TXHAMMS2",36708,728648)
200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200^200
;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks like the even rows can have a varying number of data elements. If that's the case then consider to read the data into a long structure (=creating an output observation per "cell" in source). It requires that this line of data is all of the same type as it would end up in a single output variable. Is this something you'd like to do?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 00:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-import-a-txt-file-with-multiple-delimiters/m-p/597854#M16209</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-19T00:03:11Z</dc:date>
    </item>
  </channel>
</rss>

