<?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: Read multiple records from a txt file into one value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422736#M103941</link>
    <description>&lt;P&gt;It works ! Thank you.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2017 15:41:23 GMT</pubDate>
    <dc:creator>thogir28</dc:creator>
    <dc:date>2017-12-20T15:41:23Z</dc:date>
    <item>
      <title>Read multiple records from a txt file into one value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422716#M103939</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a txt file that contains multiple equations which are separated by ";".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some equations are&amp;nbsp;splited into 2 records because they are very long.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example below eq1 and eq3 are not separated but eq2 is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eq1 = x1*a+ x2*b + x3*c&amp;nbsp;;&lt;/P&gt;&lt;P&gt;eq2 = x1*a + x2*b +&lt;/P&gt;&lt;P&gt;x3*c + x4*d ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eq3 = x1*a + x2*b + x3*c ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a dataset with only 1 variable that contains one row for each equations like that :&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR1&lt;/P&gt;&lt;P&gt;eq1=&lt;SPAN&gt;eq1 = x1*a+ x2*b + x3*c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;eq2 = x1*a + x2*b +x3*c + x4*d&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;eq3 = x1*a + x2*b + x3*c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The basic code to import is :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data temp;&lt;BR /&gt;infile "txt_file" dlm=";" ;&lt;BR /&gt;input var1 :$1000.;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried many things but nothing works. Every time SAS creates 2 rows for the splitted equations. I know with this exemple you can just add a data step after the import and concatenate the 2 separeted row for the equation 2 but I cannot do that with my real data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 15:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422716#M103939</guid>
      <dc:creator>thogir28</dc:creator>
      <dc:date>2017-12-20T15:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple records from a txt file into one value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422723#M103940</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile datalines4 truncover;
input equation $400.;
do while (substr(equation,length(equation),1) ne ';');
  input add_line $200.;
  equation = catx(' ',equation,add_line);
end;
drop add_line;
datalines4;
eq1 = x1*a+ x2*b + x3*c ;
eq2 = x1*a + x2*b +
x3*c + x4*d ; 
eq3 = x1*a + x2*b + x3*c ;
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Dec 2017 15:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422723#M103940</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-20T15:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple records from a txt file into one value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422736#M103941</link>
      <description>&lt;P&gt;It works ! Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 15:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-records-from-a-txt-file-into-one-value/m-p/422736#M103941</guid>
      <dc:creator>thogir28</dc:creator>
      <dc:date>2017-12-20T15:41:23Z</dc:date>
    </item>
  </channel>
</rss>

