<?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 Record in multiple lines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228692#M41331</link>
    <description>I hav a sas data set with my data for one record getting spilled as say 5 lines (this may vary for different recordss)however the 6th line would be a blank .so i know its an end of record..how do i read these 5 records as one record ?&lt;BR /&gt;&lt;BR /&gt;Example&lt;BR /&gt;&lt;BR /&gt;38b&lt;BR /&gt;Elgin road&lt;BR /&gt;Kolkata-30&lt;BR /&gt;&lt;BR /&gt;These appear as separate records but is actually one address&lt;BR /&gt;&lt;BR /&gt;Need help to deaign a macro to read this as a single record</description>
    <pubDate>Tue, 06 Oct 2015 18:31:09 GMT</pubDate>
    <dc:creator>Pj1989</dc:creator>
    <dc:date>2015-10-06T18:31:09Z</dc:date>
    <item>
      <title>Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228692#M41331</link>
      <description>I hav a sas data set with my data for one record getting spilled as say 5 lines (this may vary for different recordss)however the 6th line would be a blank .so i know its an end of record..how do i read these 5 records as one record ?&lt;BR /&gt;&lt;BR /&gt;Example&lt;BR /&gt;&lt;BR /&gt;38b&lt;BR /&gt;Elgin road&lt;BR /&gt;Kolkata-30&lt;BR /&gt;&lt;BR /&gt;These appear as separate records but is actually one address&lt;BR /&gt;&lt;BR /&gt;Need help to deaign a macro to read this as a single record</description>
      <pubDate>Tue, 06 Oct 2015 18:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228692#M41331</guid>
      <dc:creator>Pj1989</dc:creator>
      <dc:date>2015-10-06T18:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228700#M41332</link>
      <description>&lt;P&gt;Your example ony shows 3 lines of data. To read across multiple lines of data in an INPUT statement use the carriage control character: /.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input      @1 address_number $8.
         / @1 address_street $30.
         / @1 address_city $30.
         ;  &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2015 18:58:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228700#M41332</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-10-06T18:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228713#M41333</link>
      <description>&lt;P&gt;A macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile datalines truncover;
length line line1-line5 $32;
array l{5} line1-line5;
i = 1;
do until(missing(line));
    input line &amp;amp;;
    if i &amp;lt;= 5 then l{i} = line;
    i + 1;
    end;
id + 1;
drop i line;
datalines;
One line

Two 
lines

Three 
short
lines

Four 
lines
is more than
enough

Five
lines
is way
too 
much

;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2015 19:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228713#M41333</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-06T19:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228721#M41336</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;just one added idea ... you could increment "i" in the loop rather than initializing and incrementing in separate statements ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;do i=1 by 1 until(missing(line));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;input line &amp;amp;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;if i &amp;lt;= 5 then l{i} = line;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 20:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228721#M41336</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-10-06T20:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228728#M41338</link>
      <description>&lt;P&gt;Here is another solutions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data&amp;nbsp; have;&lt;BR /&gt;infile cards;&lt;BR /&gt;input&amp;nbsp; address $25.;&lt;BR /&gt;cards;&lt;BR /&gt;38b&lt;BR /&gt;Elgin road&lt;BR /&gt;Kolkata-30&lt;BR /&gt;&lt;BR /&gt;25&lt;BR /&gt;Main St&lt;BR /&gt;Pittsburgh&lt;BR /&gt;PA&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data count;&lt;BR /&gt;set have;&lt;BR /&gt;count+1;&lt;BR /&gt;if missing(address) then count = 0;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data prep;&lt;BR /&gt;set count;&lt;BR /&gt;by address notsorted;&lt;BR /&gt;%macro lag;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do i = 1 %to 5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;lag_address_&amp;amp;i = lag&amp;amp;i(address);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%lag;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data prep2;&lt;BR /&gt;set prep;&lt;BR /&gt;%macro deletes;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%do i = 1 %to 5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let j = %eval(&amp;amp;i+1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if missing(lag_address_&amp;amp;i) then call missing(lag_address_&amp;amp;j);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%mend;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%deletes;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set prep;&lt;BR /&gt;if count = 0 then do;&lt;BR /&gt;address2 = catx(' ',of lag_address_5-lag_address_1);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 21:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228728#M41338</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-10-06T21:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228748#M41343</link>
      <description>&lt;P&gt;I like the approach ... just picking a small nit. &amp;nbsp;The incoming file might not contain a blank line at the end. &amp;nbsp;You might want to add some handling for that to make sure that the last address is part of the output.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 22:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228748#M41343</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-10-06T22:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Record in multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228805#M41356</link>
      <description>Thank u so much</description>
      <pubDate>Wed, 07 Oct 2015 09:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Record-in-multiple-lines/m-p/228805#M41356</guid>
      <dc:creator>Pj1989</dc:creator>
      <dc:date>2015-10-07T09:40:46Z</dc:date>
    </item>
  </channel>
</rss>

