<?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: Multiple-value prompts except eg_param function. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974387#M46154</link>
    <description>Good day.&lt;BR /&gt;Did you finally get it right?&lt;BR /&gt;I also need help with the same problem, my prompt only returns the first value or name I entered on my multiple values field&lt;BR /&gt;</description>
    <pubDate>Mon, 08 Sep 2025 07:48:33 GMT</pubDate>
    <dc:creator>DLehwidi</dc:creator>
    <dc:date>2025-09-08T07:48:33Z</dc:date>
    <item>
      <title>Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/684838#M37043</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;In the SAS Enterprise Guide, a prompt defined that allows the user to select multiple values. Now in my PROC SQL, the prompt value returned is of a single value and not off of those I did type in&amp;nbsp;like I expected. This is the code that I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro promptList(&lt;/P&gt;&lt;P&gt;promptVar = v_num,&lt;BR /&gt;quotedList = yes&lt;BR /&gt;listName = v_num);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%local i list;&lt;/P&gt;&lt;P&gt;%do i = 1 %to &amp;amp;&amp;amp;&amp;amp;promptVar._COUNT.;&lt;BR /&gt;%if &amp;amp;i. eq 1 %then&lt;BR /&gt;%if &amp;amp;quotedList eq yes %then&lt;BR /&gt;%let list = %quote(%'&amp;amp;&amp;amp;&amp;amp;promptVar.%');&lt;BR /&gt;%else&lt;BR /&gt;%let list = &amp;amp;&amp;amp;&amp;amp;promptVar.;&lt;BR /&gt;%else&lt;/P&gt;&lt;P&gt;%if &amp;amp;quotedList eq yes %then&lt;BR /&gt;%let list = &amp;amp;&amp;amp;&amp;amp;listName., %quote(%'&amp;amp;&amp;amp;&amp;amp;promptVar&amp;amp;i.%');&lt;BR /&gt;%else&lt;BR /&gt;%let list = &amp;amp;&amp;amp;&amp;amp;listName., &amp;amp;&amp;amp;&amp;amp;promptVar&amp;amp;i.;&lt;BR /&gt;%end;&lt;BR /&gt;%let list = %unquote(&amp;amp;&amp;amp;&amp;amp;listName.);&lt;BR /&gt;&amp;amp;list&lt;BR /&gt;%mend promptList;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE Work.Payroll_History AS&lt;BR /&gt;SELECT&amp;nbsp;t1.V_NUMBER&amp;nbsp;FROM HRS_PAYROLL t1&lt;BR /&gt;WHERE t1.V_NUMBER in (%promptList(v_num));&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It pops up 2 errors:&amp;nbsp;&lt;BR /&gt;ERROR: More positional parameters found than defined.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant, a missing value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone can help me with this? Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 00:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/684838#M37043</guid>
      <dc:creator>Chris999</dc:creator>
      <dc:date>2020-09-18T00:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/686270#M37086</link>
      <description>&lt;P&gt;Well, for one thing, you're missing a comma between the 2nd and 3rd parameters in your macro definition.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1600917281800.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49736i4D6EDCCE84A58320/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1600917281800.png" alt="jimbarbour_0-1600917281800.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, it's super helpful if you use the Code icon whenever you include sample code otherwise the code loses all formatting and is tough to follow.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_1-1600917361330.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49737iFD5C57B5EA354D46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_1-1600917361330.png" alt="jimbarbour_1-1600917361330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lastly, I'm not clear on what you're trying to do.&amp;nbsp; Can you include a screen shot of the options in the prompt?&amp;nbsp; What are the choices?&amp;nbsp; And what are you trying to do?&amp;nbsp; Sorry; I'm just not following you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 03:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/686270#M37086</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-24T03:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/686284#M37088</link>
      <description>&lt;P&gt;I'm still not 100% sure what you're trying to do.&amp;nbsp;&amp;nbsp;However, here's an example of taking values from a multi-value prompt (see below) and using them in an SQL statement, which I think is basically what you were trying to do.&amp;nbsp; I don't have access to your tables, so I'm just using SAShelp.Cars.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the things I think may have been throwing you off was the use of a &lt;EM&gt;triple&lt;/EM&gt; ampersand.&amp;nbsp; A triple ampersand is used when you want to have the name of the macro variable be determined dynamically.&amp;nbsp; I'm not sure that's really our use case here.&amp;nbsp; A multi-value&amp;nbsp;prompt is stored in a macro array.&amp;nbsp; The most typical notation for accessing the values of a macro array is a &lt;EM&gt;double&lt;/EM&gt; ampersand followed by a macro subscript:&amp;nbsp; &amp;amp;&amp;amp;var&amp;amp;i.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The lame thing (in my opinion) about how SAS EG does multi-value prompts is that if there's only 1 occurrence in the array, then the numeric suffix is dropped -- meaning that I have to write special code if the COUNT macro variable is 1.&amp;nbsp; Poor design in my opinion.&amp;nbsp; So, if my code looks a little weird there, that's why.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note:&amp;nbsp; I have a macro value defined in my autoexec.sas named sQuote which is a single quote.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO	PromptList;
	%LOCAL	i;
	%IF	%BQUOTE(&amp;amp;Model_List_Count)	=	1	%THEN
		%DO;
			&amp;amp;sQuote&amp;amp;Model_List&amp;amp;sQuote
		%END;
	%ELSE
		%DO	i		=	1	%TO	&amp;amp;Model_List_Count;
			%IF	&amp;amp;i	&amp;lt;	&amp;amp;Model_List_Count	%THEN
				%DO;
					&amp;amp;sQuote&amp;amp;&amp;amp;Model_List&amp;amp;i&amp;amp;sQuote,
				%END;
			%ELSE
				%DO;
					&amp;amp;sQuote&amp;amp;&amp;amp;Model_List&amp;amp;i&amp;amp;sQuote 
				%END;
		%END;
%MEND	PromptList;

PROC SQL;
	CREATE TABLE Work.Cars AS
		SELECT	Make
				,Model
				,MSRP
			FROM	SAShelp.Cars
			WHERE Make IN (%UNQUOTE(%PromptList))
			ORDER	BY	Make, Model
			;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here's where I'm selecting a couple of Makes of automobiles in my EG prompt pop-up:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1600926753123.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49741i60DB036EAC98DEDA/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1600926753123.png" alt="jimbarbour_0-1600926753123.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And finally, here are the results of my SQL query after my PromptList macro has processed the values from the EG prompts:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_1-1600926834279.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49742i93A7065ABE1AC18F/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_1-1600926834279.png" alt="jimbarbour_1-1600926834279.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 05:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/686284#M37088</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-24T05:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974387#M46154</link>
      <description>Good day.&lt;BR /&gt;Did you finally get it right?&lt;BR /&gt;I also need help with the same problem, my prompt only returns the first value or name I entered on my multiple values field&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Sep 2025 07:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974387#M46154</guid>
      <dc:creator>DLehwidi</dc:creator>
      <dc:date>2025-09-08T07:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974388#M46155</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/347803"&gt;@Chris999&lt;/a&gt;&amp;nbsp;has not been here since 2020.&lt;/P&gt;
&lt;P&gt;Please post your question in a new thread, and supply the EG prompt definition and the code you use to parse the user input.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2025 08:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974388#M46155</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-09-08T08:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974862#M46166</link>
      <description>&lt;P&gt;Hi Chris999,&lt;/P&gt;
&lt;P&gt;Refer to my post from just a few minutes ago:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-multiple-values-in-Prompt/m-p/974391#M46156" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-multiple-values-in-Prompt/m-p/974391#M46156&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It works for both types of prompts (entering multiple values, or selecting multiple values from a list).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Bill&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 17:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974862#M46166</guid>
      <dc:creator>BillSawyer</dc:creator>
      <dc:date>2025-09-11T17:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974869#M46170</link>
      <description>&lt;P&gt;There are already several answers in the thread you started Monday:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-multiple-values-in-Prompt/m-p/974391#M46156" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-multiple-values-in-Prompt/m-p/974391#M46156&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please review, and respond in that discussion thread if you have followup questions.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 18:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/974869#M46170</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-09-11T18:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/977575#M46230</link>
      <description>This seem so be a great option to go with but I wish i could get more clarity on how you went about it. especial the "sQuote" , "%BQUOTE" part</description>
      <pubDate>Wed, 22 Oct 2025 12:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/977575#M46230</guid>
      <dc:creator>DLehwidi</dc:creator>
      <dc:date>2025-10-22T12:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple-value prompts except eg_param function.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/977576#M46231</link>
      <description>&lt;P&gt;Ohh and another problem is that I don't have a list of names and I am fussy searching through a list of columns.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Oct 2025 12:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-value-prompts-except-eg-param-function/m-p/977576#M46231</guid>
      <dc:creator>DLehwidi</dc:creator>
      <dc:date>2025-10-22T12:12:52Z</dc:date>
    </item>
  </channel>
</rss>

