<?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: Error using multiple values in a parameters in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371318#M24238</link>
    <description>&lt;P&gt;I actually don't know, as you says it's in EG somewhere.&lt;/P&gt;
&lt;P&gt;If you use prompts in queries, you can se the macro-statements in the code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Fredrik&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2017 14:36:59 GMT</pubDate>
    <dc:creator>FredrikE</dc:creator>
    <dc:date>2017-06-28T14:36:59Z</dc:date>
    <item>
      <title>Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/370904#M24191</link>
      <description>&lt;P&gt;Hi, I am using a parameter in Guide that accept multiple values in a static list. This parameter is text and is called: segmento.&lt;/P&gt;
&lt;P&gt;Now, in a query builder I am using this parameter in a where clause, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where cod_segmento in ("&amp;amp;segmento")
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have to use " because if not I have an error&lt;/P&gt;
&lt;P&gt;When I execute I select three values of segmento in the prompt, but the SQL only takes the first one.&lt;/P&gt;
&lt;P&gt;Is there any solution?, do I have to define the param in other way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 13:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/370904#M24191</guid>
      <dc:creator>juanvg1972</dc:creator>
      <dc:date>2017-06-27T13:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/370945#M24194</link>
      <description>&lt;P&gt;What does &amp;amp;segmento. resolve to? &amp;nbsp;If you macro variable looks like this:&lt;/P&gt;
&lt;P&gt;ABC DEF&lt;/P&gt;
&lt;P&gt;Then your code will look like this:&lt;/P&gt;
&lt;P&gt;where cod_segmento in ("ABC DEF")&lt;/P&gt;
&lt;P&gt;Which isn't what you want, so you would have to manipluate it a bit:&lt;/P&gt;
&lt;PRE&gt;%let segmento=M F;
&lt;BR /&gt;/* Example out of code */
%put %sysfunc(tranwrd("&amp;amp;segmento.",%str( ),","));
&lt;BR /&gt;/* Example in where clause */
data want;
  set sashelp.class;
  where sex in (%sysfunc(tranwrd("&amp;amp;segmento.",%str( ),",")));
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 14:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/370945#M24194</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-27T14:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371018#M24198</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have resolved using all values inserted in the parameters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The parameter es segmento&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;segmento1: fisrst value&lt;/P&gt;
&lt;P&gt;segmento2: second calue&lt;/P&gt;
&lt;P&gt;segmento3: thris value&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 18:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371018#M24198</guid>
      <dc:creator>juanvg1972</dc:creator>
      <dc:date>2017-06-27T18:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371020#M24199</link>
      <description>&lt;P&gt;You will get mulitple macro variables to hold the multiple selections.&lt;/P&gt;
&lt;P&gt;You will need to pre-process them to make the useful in the WHERE clause.&lt;/P&gt;
&lt;P&gt;So something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length str $32767 ;
  do i=1 to &amp;amp;segmento_count ;
    str = catx(' ',quote(cats('&amp;amp;segmento',i)));
  end;
  call symputx('segmento_all',str);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will create a new macro variable named SEGMENTO_ALL with values like "&amp;amp;segmento1" "&amp;amp;segment2" .... based on how many values where selected.&lt;/P&gt;
&lt;P&gt;Then your WHERE clause can use that new macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where cod_segmento in (&amp;amp;segmento_all)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 18:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371020#M24199</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-27T18:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371285#M24236</link>
      <description>&lt;P&gt;Tom's solution is good, but you can also use EG's own macros:&lt;/P&gt;
&lt;P&gt;data ...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set ....;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;where %&lt;STRONG&gt;&lt;I&gt;_eg_WhereParam&lt;/I&gt;&lt;/STRONG&gt;( cod_segmento, segmento, &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, TYPE=S, IS_EXPLICIT=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; )&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read&amp;nbsp;more in this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompt-Manager-question-with-SAS-EG/m-p/361199#M23740" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompt-Manager-question-with-SAS-EG/m-p/361199#M23740&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 13:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371285#M24236</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2017-06-28T13:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371317#M24237</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13827"&gt;@FredrikE&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Tom's solution is good, but you can also use EG's own macros:&lt;/P&gt;
&lt;P&gt;data ...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set ....;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;where %&lt;STRONG&gt;&lt;I&gt;_eg_WhereParam&lt;/I&gt;&lt;/STRONG&gt;( cod_segmento, segmento, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;IN&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, TYPE=S, IS_EXPLICIT=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; )&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read&amp;nbsp;more in this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompt-Manager-question-with-SAS-EG/m-p/361199#M23740" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompt-Manager-question-with-SAS-EG/m-p/361199#M23740&lt;/A&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where can we find the source for this macro? &amp;nbsp;It is not in the autocall macros that come with SAS. It must be with Enterprise Guide somewhere.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 14:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371317#M24237</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-28T14:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error using multiple values in a parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371318#M24238</link>
      <description>&lt;P&gt;I actually don't know, as you says it's in EG somewhere.&lt;/P&gt;
&lt;P&gt;If you use prompts in queries, you can se the macro-statements in the code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Fredrik&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 14:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Error-using-multiple-values-in-a-parameters/m-p/371318#M24238</guid>
      <dc:creator>FredrikE</dc:creator>
      <dc:date>2017-06-28T14:36:59Z</dc:date>
    </item>
  </channel>
</rss>

