<?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: Reading Multi Selection Variables in From a Stored Process. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619681#M182003</link>
    <description>&lt;P&gt;Is this what you&amp;nbsp; are looking for:&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList curProgramList1 curProgramList_count;
	%let curProgramList = BS-MAC-PB;
	%let curProgramList_count = 1;

	
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put &amp;amp;i;
		%let curProgram = &amp;amp;&amp;amp;curProgramList&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;

%ProgramDisplay();&lt;/PRE&gt;
&lt;P&gt;In the variable &amp;amp;&amp;amp;curProgramList&amp;amp;i. the leading &amp;amp; followed by another tells SAS to "hold on evaluating" then evaluates the bit after the first &amp;amp;&amp;nbsp;, The evaluates the result with the &amp;amp;, so is after one pass &amp;amp;curprogram1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is in the documentation under Referencing &lt;FONT style="background-color: rgb(252, 222, 192);"&gt;Macro&lt;/FONT&gt; Variables Indirectly,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Useful but can be hard to debug when you see a variable like &amp;amp;&amp;amp;&amp;amp;&amp;amp;this&amp;amp;&amp;amp;bit&amp;amp;that.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 21:19:37 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-01-23T21:19:37Z</dc:date>
    <item>
      <title>Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619614#M181967</link>
      <description>&lt;P&gt;Somehow the value of curProgramList1 is transformed from BS-MAC-PB1 to BSMAC-PB1 with the below.&amp;nbsp; and the error message&amp;nbsp;ERROR: Invalid symbolic variable name BSMAC-PB1. is displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%do i = 1 %to &amp;amp;curProgramList_count;
		%let curProgram = %superq(&amp;amp;curProgramList&amp;amp;i);
		%put "Test5";
	  	%put curProgram &amp;amp;curProgram;
		%if &amp;amp;curProgram eq %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;
%ProgramDisplay();
&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 18:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619614#M181967</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-01-23T18:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619630#M181977</link>
      <description>&lt;P&gt;David,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use a custom macro I developed long time ago, that handles Single &amp;amp; Multi value parameters, and returns a delimited string of the selected value(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've attached a copy of the macro code, and it contains a sample usage in the header comments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 18:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619630#M181977</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2020-01-23T18:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619663#M181995</link>
      <description>&lt;P&gt;What can I add to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let curProgram = &amp;amp;curProgramList.&amp;amp;i.&lt;/P&gt;
&lt;P&gt;so that curProgram = the value = curProgramList1 not curProgramList +1&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its returning BS-MAC-PB1&lt;/P&gt;
&lt;P&gt;rather than&amp;nbsp;BS-MAC-PB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList curProgramList1 curProgramList_count;
	%let curProgramList = BS-MAC-PB;
	%let curProgramList_count = 1;

	
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put &amp;amp;i;
		%let curProgram = &amp;amp;curProgramList.&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;

%ProgramDisplay();&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 20:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619663#M181995</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-01-23T20:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619681#M182003</link>
      <description>&lt;P&gt;Is this what you&amp;nbsp; are looking for:&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList curProgramList1 curProgramList_count;
	%let curProgramList = BS-MAC-PB;
	%let curProgramList_count = 1;

	
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put &amp;amp;i;
		%let curProgram = &amp;amp;&amp;amp;curProgramList&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;

%ProgramDisplay();&lt;/PRE&gt;
&lt;P&gt;In the variable &amp;amp;&amp;amp;curProgramList&amp;amp;i. the leading &amp;amp; followed by another tells SAS to "hold on evaluating" then evaluates the bit after the first &amp;amp;&amp;nbsp;, The evaluates the result with the &amp;amp;, so is after one pass &amp;amp;curprogram1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is in the documentation under Referencing &lt;FONT style="background-color: rgb(252, 222, 192);"&gt;Macro&lt;/FONT&gt; Variables Indirectly,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Useful but can be hard to debug when you see a variable like &amp;amp;&amp;amp;&amp;amp;&amp;amp;this&amp;amp;&amp;amp;bit&amp;amp;that.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 21:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619681#M182003</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-23T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619682#M182004</link>
      <description>&lt;P&gt;Ballardw,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for explaining the &amp;amp;&amp;amp;.&amp;nbsp; That helps a lot.&amp;nbsp; I think i'm close to working through the multiple dynamic prompts.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 21:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/619682#M182004</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-01-23T21:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/620679#M182418</link>
      <description>&lt;P&gt;This worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList1;
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = 
       &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put &amp;amp;i;
		%let curProgram = &amp;amp;&amp;amp;curProgramList&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jan 2020 21:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/620679#M182418</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2020-01-28T21:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Multi Selection Variables in From a Stored Process.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/620703#M182431</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5059"&gt;@DavidPhillips2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This worked&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList1;
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = 
       &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put &amp;amp;i;
		%let curProgram = &amp;amp;&amp;amp;curProgramList&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6;
		%end;
	%end;
%mend;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A minor suggestion which may save you much time later down the road when you start having macros calling each other is to make your diagnostic %put a bit more comprehensive by including variable name and macro scope of variables. This may save having to wade through a bunch of OPTIONS MPRINT SYMBOLGEN output. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro ProgramDisplay();
	%global curProgramList1;
	%if &amp;amp;curProgramList_count = 1 %then %let curProgramList1 = 
       &amp;amp;curProgramList;
	%put test4 &amp;amp;curProgramList1;
	%do i = 1 %to &amp;amp;curProgramList_count;
		%put i = &amp;amp;i in ProgramDisplay;
		%let curProgram = &amp;amp;&amp;amp;curProgramList&amp;amp;i.;
		%put "Test8" curProgram &amp;amp;curProgram  in ProgramDisplay;
		%if "&amp;amp;curProgram." = "" %then %do;
		%end;
		%else %do;
			%put Test6  in ProgramDisplay;
		%end;
	%end;
%mend;&lt;/PRE&gt;
&lt;P&gt;This may be moderately critical if you have the ancient tradition of "%do&amp;nbsp;I=1 %to "&amp;nbsp;in multiple places.&lt;/P&gt;
&lt;P&gt;And for added piece of mind if never hurts to have %local i;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 22:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-Multi-Selection-Variables-in-From-a-Stored-Process/m-p/620703#M182431</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-28T22:50:30Z</dc:date>
    </item>
  </channel>
</rss>

