<?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: concatenating variable number of text lines with identical keys in table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265302#M52157</link>
    <description>&lt;DIV class="lia-quilt-column lia-quilt-column-04 lia-quilt-column-left lia-quilt-column-main-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-author lia-component-author"&gt;&lt;DIV class="lia-message-author-rank"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;Hello All. &amp;nbsp;I'm back again. &amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;My code below works, but it cuts off much earlier than the max length I set it for. &amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Whenever the date_time stamp is concatenated with it, it appears not to be able to take the full string for seq 1 (line one) of each note.&lt;/P&gt;&lt;P&gt;I came across another post saying that if there is a where clause in the statement then cats and cat() can only handle $200 length. &amp;nbsp;This is a huge problem for me as I can't have the middle of messages just drop off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone think of a way where I can:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a) &amp;nbsp;conditionally insert a record for each (ID Time_STAMP) combination that I could then run the following code on where it would not be subject to this constraint?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) concat the timestamp to the begining of the note without using my if seq=1 line (that I think is causing the limit of characters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;c) redistribute the the text that would be cut off, to the next line, on and on down to the last line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;d)re-arrange my code in a way that would still make this work and would not be subject to the the text cutting off before 32767 character limit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example of what's happening (and see pic below and excel document attached containing what's in the picture):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Survey &amp;nbsp; &amp;nbsp; ID &amp;nbsp; &amp;nbsp;date_time &amp;nbsp; &amp;nbsp; &amp;nbsp; Seq &amp;nbsp; &amp;nbsp; &amp;nbsp;time_key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Textx&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;sasdatetime1 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;sasdatetime1 &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; World&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; sasdatetime2 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Good&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; sasdatetime2 &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bye&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;so what the code below produces is:&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sasdatetime 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; (sastime1) Hel World&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;(See actual) case in attached excel document. &amp;nbsp;Although I've set textx and new_text fields for&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;length new_text $32767;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2866i0E494596C05CE0C3/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Sample for SasForum.jpg" title="Sample for SasForum.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data notes;
set other.SUPPLY_NOTES;
length Textx $32767;
keep ID Survey SEQ Textx Item_Steps time_key date_time;
If (SEQ=1 and item_steps not in ("","."," ")) &lt;BR /&gt;then do textx=cat('(',put(date_time,datetime18.),') ','||',"ITEM: ",ITEM_Steps,' || ',textx); &lt;BR /&gt;end;

data notes;
set other.SUPPLY_NOTES;
keep ID Survey SEQ Textx Item_Steps time_key date_time;
where survey="115";
run;
&lt;BR /&gt;proc sort data=notes;
by id time_key SEQ;
Run;&lt;BR /&gt;
proc sort data=itemnotes;
by id time_key SEQ;
Run;
&lt;BR /&gt;data notesconcat;
set notes;
by ID time_key Seq;
length new_text $32767;
retain new_text;
new_text=catx(' ',new_text,textx);
if last.id then do;
output;
call missing(new_text);
drop line Textx;
end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all for your assistance in advance!&lt;/P&gt;&lt;DIV class="Attachments preview-attachments"&gt;&lt;DIV class="lia-attachment attachment-1 lia-attachment-row"&gt;&lt;DIV class="lia-attachment-row-element"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-attachment-row-element lia-media-document"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 21 Apr 2016 03:25:55 GMT</pubDate>
    <dc:creator>aero</dc:creator>
    <dc:date>2016-04-21T03:25:55Z</dc:date>
    <item>
      <title>Re: concatenating variable number of text lines with identical keys in table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265302#M52157</link>
      <description>&lt;DIV class="lia-quilt-column lia-quilt-column-04 lia-quilt-column-left lia-quilt-column-main-left"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;&lt;DIV class="lia-message-author lia-component-author"&gt;&lt;DIV class="lia-message-author-rank"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;Hello All. &amp;nbsp;I'm back again. &amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-author-ipaddress"&gt;My code below works, but it cuts off much earlier than the max length I set it for. &amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Whenever the date_time stamp is concatenated with it, it appears not to be able to take the full string for seq 1 (line one) of each note.&lt;/P&gt;&lt;P&gt;I came across another post saying that if there is a where clause in the statement then cats and cat() can only handle $200 length. &amp;nbsp;This is a huge problem for me as I can't have the middle of messages just drop off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone think of a way where I can:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a) &amp;nbsp;conditionally insert a record for each (ID Time_STAMP) combination that I could then run the following code on where it would not be subject to this constraint?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b) concat the timestamp to the begining of the note without using my if seq=1 line (that I think is causing the limit of characters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;c) redistribute the the text that would be cut off, to the next line, on and on down to the last line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;d)re-arrange my code in a way that would still make this work and would not be subject to the the text cutting off before 32767 character limit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example of what's happening (and see pic below and excel document attached containing what's in the picture):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Survey &amp;nbsp; &amp;nbsp; ID &amp;nbsp; &amp;nbsp;date_time &amp;nbsp; &amp;nbsp; &amp;nbsp; Seq &amp;nbsp; &amp;nbsp; &amp;nbsp;time_key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Textx&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;sasdatetime1 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Hello&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;sasdatetime1 &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; World&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; sasdatetime2 &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Good&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; sasdatetime2 &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sastime2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bye&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;so what the code below produces is:&lt;/P&gt;&lt;P&gt;123 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sasdatetime 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; sastime1 &amp;nbsp; &amp;nbsp; &amp;nbsp; (sastime1) Hel World&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;(See actual) case in attached excel document. &amp;nbsp;Although I've set textx and new_text fields for&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;length new_text $32767;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2866i0E494596C05CE0C3/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Sample for SasForum.jpg" title="Sample for SasForum.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data notes;
set other.SUPPLY_NOTES;
length Textx $32767;
keep ID Survey SEQ Textx Item_Steps time_key date_time;
If (SEQ=1 and item_steps not in ("","."," ")) &lt;BR /&gt;then do textx=cat('(',put(date_time,datetime18.),') ','||',"ITEM: ",ITEM_Steps,' || ',textx); &lt;BR /&gt;end;

data notes;
set other.SUPPLY_NOTES;
keep ID Survey SEQ Textx Item_Steps time_key date_time;
where survey="115";
run;
&lt;BR /&gt;proc sort data=notes;
by id time_key SEQ;
Run;&lt;BR /&gt;
proc sort data=itemnotes;
by id time_key SEQ;
Run;
&lt;BR /&gt;data notesconcat;
set notes;
by ID time_key Seq;
length new_text $32767;
retain new_text;
new_text=catx(' ',new_text,textx);
if last.id then do;
output;
call missing(new_text);
drop line Textx;
end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all for your assistance in advance!&lt;/P&gt;&lt;DIV class="Attachments preview-attachments"&gt;&lt;DIV class="lia-attachment attachment-1 lia-attachment-row"&gt;&lt;DIV class="lia-attachment-row-element"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-attachment-row-element lia-media-document"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Apr 2016 03:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265302#M52157</guid>
      <dc:creator>aero</dc:creator>
      <dc:date>2016-04-21T03:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating variable number of text lines with identical keys in table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265305#M52160</link>
      <description>&lt;P&gt;No attachment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post data/code that replicates your issue please. You should be able to go up to length 32K/64K without any issues.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 03:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265305#M52160</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-21T03:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating variable number of text lines with identical keys in table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265781#M52320</link>
      <description>&lt;P&gt;I figured it out. &amp;nbsp;Apparently the source table was imposing a limit on the textx variable of 60 characters. &amp;nbsp;When I concatenated date_time to the values with seq=1 it would exceed 60char and drop the remaining characters before concatenating the next line.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 21:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-concatenating-variable-number-of-text-lines-with-identical/m-p/265781#M52320</guid>
      <dc:creator>aero</dc:creator>
      <dc:date>2016-04-22T21:48:12Z</dc:date>
    </item>
  </channel>
</rss>

