<?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: Convert multiline text prompt to table with a single column? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/910027#M44118</link>
    <description>Thanks for confirming.&lt;BR /&gt;</description>
    <pubDate>Tue, 02 Jan 2024 05:42:38 GMT</pubDate>
    <dc:creator>Jase</dc:creator>
    <dc:date>2024-01-02T05:42:38Z</dc:date>
    <item>
      <title>Convert multiline text prompt to table with a single column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/909880#M44116</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Using SAS EG 8.3 and SAS9.4, and SAS is not my usual programming language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a&amp;nbsp;multiline text prompt which I need to convert to a table with a single column (from which I can do a join on another table to filter).&lt;/P&gt;
&lt;P&gt;So, essentially, for this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%LET input_values = 1000456001
2000789002
3008246003;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to turn it into:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 48pt;" border="0" width="64" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;result&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;1000456001&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;2000789002&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" class="xl63" style="height: 15.0pt; border-top: none;"&gt;3008246003&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried this code:&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;%LET input_values = 1000456001
2000789002
3008246003;

data input (keep = result);
string = "&amp;amp;input_values.";
do i=1 by 1 while (scan(string,i,'#') ^= ' ');
result=scan(string,i,'#');
output;
end;
run;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;However, there are scenarios where the list of values might contain 10k distinct values and I receive this error code:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: The text expression length (65537) exceeds maximum length (65534). The text expression has been truncated to 65534 characters.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I presume this is happening because SAS is storing the input_values variable as a single value field rather than an array of values?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;And/or the scan function is a SAS macro vairable with the 65534 length limitation?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Can anyone suggest an alternate approach to creating the table of values whilst retaining the use of the prompt?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or am I stuck having to use something like:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data my_data;
input result;
cards;
10000001
10000002
10000003
;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(As previously stated, I really prefer to retain the prompt rather than forcing users to copy/paste into the program code.)&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 04:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/909880#M44116</guid>
      <dc:creator>Jase</dc:creator>
      <dc:date>2023-12-29T04:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert multiline text prompt to table with a single column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/909900#M44117</link>
      <description>&lt;P&gt;User prompts store the values in macro variables, and macro variables are limited to 64k characters (actually, 65534 as you see in the ERROR message). So you are overstraining what SAS prompts can do for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would look into a method using a text file; your users already have this mass of data in some form, so why not let them save it to a place where the SAS code can pick it up?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 14:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/909900#M44117</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-12-29T14:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Convert multiline text prompt to table with a single column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/910027#M44118</link>
      <description>Thanks for confirming.&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2024 05:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Convert-multiline-text-prompt-to-table-with-a-single-column/m-p/910027#M44118</guid>
      <dc:creator>Jase</dc:creator>
      <dc:date>2024-01-02T05:42:38Z</dc:date>
    </item>
  </channel>
</rss>

