<?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: Prompt - How to handle commas in user entered list of values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239220#M308793</link>
    <description>&lt;P&gt;Thanks ballardw. I will check this way out also. &amp;nbsp;I received a solution from another post, but I will check this method out as well. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Dec 2015 18:18:49 GMT</pubDate>
    <dc:creator>KelseyB</dc:creator>
    <dc:date>2015-12-14T18:18:49Z</dc:date>
    <item>
      <title>Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239202#M308786</link>
      <description>&lt;LI-SPOILER&gt;Hello,&lt;BR /&gt;I am hoping someone can help me with the following. I have created a prompt within Enterprise Guide that accepts user-entered text as a single value. The user will enter a list of numbers or text separated by commas. I want to capture the list of values and then replace the commas with single quote comma single quote. &lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;User enters 1,2,3, and it is stored in macro variable DRGFilterCommas. &lt;BR /&gt;DRGCommas_List is created and stores '1','2','3'&lt;BR /&gt;&lt;BR /&gt;I do not want to allow the user to enter multiple values (I have tried that already), but the user could enter 30 values and entering one at a time is cumbersome as well.&lt;BR /&gt;&lt;BR /&gt;Here is the code I have so far:&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt; DRGCommas_temp=tranwrd(%str(&amp;amp;DRGFilterCommas),",","','");&lt;BR /&gt; DRGCommas_List=cat("'",trim(DRGCommas_temp),"'");&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Here is the error I am getting:&lt;BR /&gt;&lt;BR /&gt;ERROR 72-185: The TRANWRD function call has too many arguments.&lt;BR /&gt;&lt;BR /&gt;Any ideas on how to do this are greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;KelseyB&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 14 Dec 2015 17:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239202#M308786</guid>
      <dc:creator>KelseyB</dc:creator>
      <dc:date>2015-12-14T17:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239205#M308788</link>
      <description>&lt;P&gt;Try adding&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;comma= &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;"','"&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;and use the variable instead of "','"; Too many quotes. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;I suspect that it might be easier to use a space separated list unless you are using this in multiple different contexts.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="SAS Monospace" size="2"&gt;&lt;CODE class=" language-sas"&gt;
data example;
   x = '1 2 3 4 5';
   length DRGCommas_temp $ 125;
   DRGCommas_temp='';
   do i= 1 to (countw(x));
      DRGCommas_temp= catx(',',DRGCommas_temp,quote(scan(x,i)));
   end;
run;
&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2015 17:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239205#M308788</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-14T17:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239206#M308789</link>
      <description>&lt;P&gt;Thanks ballardw. &amp;nbsp;I can't delimit with a space because the values could have spaces in them , for example, Joe Smith, Suzie Jones. etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to substitute the comma as you suggested and got the same error unfortunately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; length DRGsCommas_List $10000; &lt;BR /&gt; /*Replace comma with single quote comma single quote and then concatenate single quote at beginning and end of list of DRGs*/&lt;BR /&gt; comma = ",";&lt;BR /&gt; DRGCommas_temp=tranwrd(&amp;amp;DRGFilterCommas,comma,'comma');&lt;BR /&gt; DRGCommas_List=cat("'",trim(DRGCommas_temp),"'");&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 72-185: The TRANWRD function call has too many arguments.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 17:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239206#M308789</guid>
      <dc:creator>KelseyB</dc:creator>
      <dc:date>2015-12-14T17:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239209#M308790</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DRGFilterCommas=1,2,3; 

data _null_;
length DRGCommas_List $10000; 
DRGCommas_List=cats("'", tranwrd("&amp;amp;DRGFilterCommas", ",", "','"), "'");
put DRGCommas_List; /* just for checking */
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 18:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239209#M308790</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-12-14T18:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239214#M308791</link>
      <description>&lt;P&gt;That works FreelanceReinhard. &amp;nbsp;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 18:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239214#M308791</guid>
      <dc:creator>KelseyB</dc:creator>
      <dc:date>2015-12-14T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239216#M308792</link>
      <description>&lt;P&gt;SCAN and COUNTW allow specifying the delimiter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data example;
   x = 'Sue Jones, Fred Smith, Billy Bog';
   length DRGCommas_temp $ 1250;
   DRGCommas_temp='';
   do i= 1 to (countw(x,','));
      DRGCommas_temp= catx(',',DRGCommas_temp,quote(scan(x,i,',')));
   end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Dec 2015 18:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239216#M308792</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-14T18:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Prompt - How to handle commas in user entered list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239220#M308793</link>
      <description>&lt;P&gt;Thanks ballardw. I will check this way out also. &amp;nbsp;I received a solution from another post, but I will check this method out as well. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Dec 2015 18:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prompt-How-to-handle-commas-in-user-entered-list-of-values/m-p/239220#M308793</guid>
      <dc:creator>KelseyB</dc:creator>
      <dc:date>2015-12-14T18:18:49Z</dc:date>
    </item>
  </channel>
</rss>

