<?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: Looping a Parameter in a Program in EG in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629409#M35642</link>
    <description>&lt;P&gt;Perfect, a bit of messing around working out what was what and I have that working across multiple columns!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then need to expand it to do the same thing for a range of tables.&amp;nbsp; I have two questions for that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Do I need to combine the entire code block (The bit that calls the Macro and the Macro) I have now as a second Macro?&amp;nbsp; Then call that in the same way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; How do I modify the call block of code you've shown me so the datalines bit is feeding in linked pairs of values to two parameters?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 13:13:28 GMT</pubDate>
    <dc:creator>paulrockliffe</dc:creator>
    <dc:date>2020-03-04T13:13:28Z</dc:date>
    <item>
      <title>Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629393#M35636</link>
      <description>&lt;P&gt;I have a program that was written for me that I want to modify to encompass a bit more flexibility.&amp;nbsp; The program takes a SAS Table and splits it into subsets based on the unique values in a selected column.&amp;nbsp; I use it to create Regional subsets of national data as an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program has a parameter that defines the column to base the subsets on.&amp;nbsp; It also has a pair of parameters that sets the table that is being subset and a string that feeds into the resulting output data tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to loop the program so that it can create subsets based on more than one column.&amp;nbsp; And also loop it so that I can feed in several table/string pairs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program itself is quite complicated and I can easily copy-paste duplicate it to create the outputs I need, so I don't want to modify the code as it's simply not worth it for the extra simplicity and flexibility that looping it will give me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Essentially I want the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Loop for each Input/Output Parameter pair = Table1,String1 Table 2,String2.&lt;/P&gt;&lt;P&gt;(Loop for each Column parameter = Region, Office&lt;/P&gt;&lt;P&gt;(Program))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the solution is independent of the Program, other than passing values for the parameters into the Program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done a load of Googling and not really found a solution that works, so figured it is time to ask the experts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 11:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629393#M35636</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-04T11:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629398#M35638</link>
      <description>&lt;P&gt;So you'd want a macro the header of which would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro(dataset=,column=,string=);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 11:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629398#M35638</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T11:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629403#M35640</link>
      <description>&lt;P&gt;Yes, possibly.&amp;nbsp; Ideally the values for the Macro variables would be defined within the code block rather than being pulled from a table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem si I don't know how to wrap a Macro around the code block I think.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 12:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629403#M35640</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-04T12:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629407#M35641</link>
      <description>&lt;P&gt;It should not be that hard to do it, as you already have code that works for a single instance (as this is the most important prerequsite for macro development).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;identify the parts in your code that you would have to change manually if you run it for another instance&lt;/LI&gt;
&lt;LI&gt;replace these parts with macro variables, set the macro variables with %let before the code and test&lt;/LI&gt;
&lt;LI&gt;if the test works, replace the %let statements with the macro definition, and use the macro variable names as macro parameters; don't forget the %mend at the end&lt;/LI&gt;
&lt;LI&gt;Now you can use the macro either "manually", by writing the macro call for each instance yourself, or you can use call execute() to call the macro repeatedly from a data step (where you feed the parameters from datalines or an existing dataset.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Very simple example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step one: replace variable parts with macro vars:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dataset=sashelp.class;

proc print dataset=&amp;amp;dataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step two: wrap in macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymac(dataset);

proc print dataset=&amp;amp;dataset;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Call manually:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mymac(sashelp.class)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Call from data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input dataset $32.;
call execute('%nrstr(%mymac('!!strip(dataset)!!'))');
datalines;
sashelp.class
sashelp.cars
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The single quotes and the %nrstr() are necessary to avoid premature execution of macro triggers during the data step.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 12:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629407#M35641</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T12:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629409#M35642</link>
      <description>&lt;P&gt;Perfect, a bit of messing around working out what was what and I have that working across multiple columns!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then need to expand it to do the same thing for a range of tables.&amp;nbsp; I have two questions for that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Do I need to combine the entire code block (The bit that calls the Macro and the Macro) I have now as a second Macro?&amp;nbsp; Then call that in the same way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; How do I modify the call block of code you've shown me so the datalines bit is feeding in linked pairs of values to two parameters?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 13:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629409#M35642</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-04T13:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629411#M35643</link>
      <description>&lt;P&gt;The datalines are a kind of "inline text file", so you can use the input statement like you use it when reading an external file. The default delimiter is a blank.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input value1 $ value2 $;
call execute('%nrstr(%mymac('!!strip(value1)!!','!!strip(value2)!!'))');
datalines;
XXX YYY
ZZZ AAA
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 13:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629411#M35643</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T13:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629420#M35645</link>
      <description>&lt;P&gt;Thanks again, that's pretty simple.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you confirm that I combine my Macro Call and Macro as a new Macro and then call that to make this work?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to do it that way and am hitting an issue, but can't see anything obviously wrong.&amp;nbsp; The effect is that the code I used to call the first Macro is no longer formatting the datalines with yellow highlighting, so it looks like I'm doing something wrong!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 13:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629420#M35645</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-04T13:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629421#M35646</link>
      <description>&lt;P&gt;datalines and macro do not go together. You cannot use datalines in a macro, and you cannot use macro triggers in datalines.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 13:52:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629421#M35646</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T13:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629460#M35649</link>
      <description>&lt;P&gt;OK, that explains why that doesn't work then!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the correct way to get this to work?&amp;nbsp; I'm not sure if I can modify the data line that's calling the Macro as I think that will result in every combination of my three parameters rather than every combination of the original parameter and the parameter pair.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to mess around with that to see if there's a way to do it, but if there's a more appropriate approach it might save me some time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 15:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629460#M35649</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-04T15:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629726#M35654</link>
      <description>&lt;P&gt;You need to supply a quick example of your macro structure (from outermost to innermost), and how you intend to pass parameters from the "open code" (outside the outermost macro) down to where the real work is done. Then it should be possible to devise a method for that.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 07:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/629726#M35654</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-05T07:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/630030#M35659</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've included the program block below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input params $32.;
call execute('%nrstr(%ColumnSplit('!!strip(params)!!'))');
datalines;
Region
Sector
;

%MACRO ColumnSplit (params);


/* Sets Parameters - These are:
								The table to be split
								The location for the output tables to be created
								The parameter to split the table by
								The columns to be dropped from the output table
								A project identifier to add to the start of the resulting table names*/

%let indata=SASUSER.SOURCE;
%let outlib=SASUSER;
%let param=&amp;amp;params;
%let dropcolumns = Region Sector CCM Customer Office;
%let tablename=&amp;amp;prefix;

/* Creates a Lookup Table containing all unique values in the selected column */

proc sort
  data=&amp;amp;indata (keep=&amp;amp;param)
  out=lookup
  nodupkey
;
by &amp;amp;param;
run;

/* Modifies the contents of the lookup table so that the values are valid SAS names.  This is a necessary step as otherwise the output tables 
are built per word within the lookup table, which creates duplicates*/

data lookup;
set lookup;
vname = substr(translate(translate(translate(trim(&amp;amp;param),'','&amp;amp;'),'_',' '),'_','__'),1,32);
run;


/* Creates the output tables */

data _null_;

call execute ('data ');
do until (eof1);
  set lookup end=eof1;
  call execute("&amp;amp;outlib..&amp;amp;tablename._" !! trim(vname) !! ' ');
end;

call execute ("; set &amp;amp;indata.;");
do until(eof2);
  set lookup end=eof2;
  call execute("if &amp;amp;param = '" !! trim(&amp;amp;param) !! "' then output &amp;amp;outlib..&amp;amp;tablename._" !! trim(vname) !! ';');
end;

call execute('drop &amp;amp;dropcolumns; run;');
stop;

run;

%MEND ColumnSplit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 09:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/630030#M35659</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-06T09:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631278#M35676</link>
      <description>&lt;P&gt;So I've started using this over a set of 6 tables.&amp;nbsp; Rather than working out how to loop them I figured I would setup 6 Program nodes manually and do it that way, it's pretty simple.&amp;nbsp; I've modified "indata" and "tablename" in each program to pickup a different table and output to a new set of tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I've hit another issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I first run the code a as above it fails, but works on a second run.&amp;nbsp; If I create a second copy then it's first run pulls the parameters from the last run of the code.&amp;nbsp; The behaviour is consistent with the code creating the parameters after running the code creating the outputs, but I can't see how it's doing that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the Macro the first thing that happens is that Indata and tablename are created, so I'm stumped!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone got any ideas what's causing it and how to fix it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 16:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631278#M35676</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-11T16:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631479#M35677</link>
      <description>&lt;P&gt;I see this possible problem point:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute('drop &amp;amp;dropcolumns; run;');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Either you have to use %nrstr() to prevent premature resolution of the macro trigger, or resolve it right here, by using double quotes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute("drop &amp;amp;dropcolumns; run;");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 08:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631479#M35677</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-12T08:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631486#M35678</link>
      <description>&lt;P&gt;Always make sure to keep an eye on the scope of macro variables; declare variables used exclusively inside a macro as local (with %local), and declare variables that you need to "spill over" as global (%global). Try to avoid "invisible" side-effects by generous use of macro parameters (instead of just assuming that a global variable you use in the macro already exists)&lt;/P&gt;
&lt;P&gt;Don't do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(param1);
.......
%if &amp;amp;param2 = .....
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(param1,param2);
.......
%if &amp;amp;param2 = .....
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that makes param2 local to the macro, and forces you to be "honest" with your macro call (revealing everything that goes into the macro in the call itself).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use diagnostic tools (options mprint mlogic symbolgen) to reveal the progress of your macro(s), and use statements like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put _all_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to show the current state of your macro symbol table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 09:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631486#M35678</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-12T09:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631507#M35679</link>
      <description>&lt;P&gt;Thanks, that would make sense as I had this working and then added that bit to deal with the need to filter some tables that don't contain the columns I'm filtering by, I joined those columns back on then needed to drop them again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the double quote, that didn't work and I'm trying to get %nrstr() to work too, but struggling a bit.....&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 10:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631507#M35679</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-12T10:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631516#M35680</link>
      <description>&lt;P&gt;I can only suggest what I would do:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;start a fresh SAS session&lt;/LI&gt;
&lt;LI&gt;run the code once&lt;/LI&gt;
&lt;LI&gt;save the log to a file and clear it&lt;/LI&gt;
&lt;LI&gt;run the code a second time&lt;/LI&gt;
&lt;LI&gt;save the log again to a new file&lt;/LI&gt;
&lt;LI&gt;compare the files in a suitable editor side-by-side, or use a code compare tool&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Sometimes it needs going back to Eyeball Mk 1.&lt;/P&gt;
&lt;P&gt;When something works at first time and fails at second, or fails at first and works at second, it's about a 100% that there's some kind of uninitialized/spillover effect. That's why "side effects" in subroutines/macros etc are so dangerous.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631516#M35680</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-12T11:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631633#M35681</link>
      <description>&lt;P&gt;Thanks, I've done that and I can see from the log that the code is using the parameters from the previous run.&amp;nbsp; There's nothing in there that is standing out as a clue as to why though, so I'm a bit stumped!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 16:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631633#M35681</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-12T16:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Looping a Parameter in a Program in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631637#M35682</link>
      <description>&lt;P&gt;I managed to stop it working at all by running this Macro first.&amp;nbsp; I guess I'm now deleting the macro variables upfront, my problem is I'm then running the Macro before I've declared the variables.&amp;nbsp; I don't follow what's causing that though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro deleteALL;
 
   	options nonotes;
 
  	%local vars;
 
  	proc sql noprint;
      	     select name into: vars separated by ' '
         	  from dictionary.macros
            	      where scope='GLOBAL' 
			   and not name contains 'SYS_SQL_IP_';
   	quit;
 
   	%symdel &amp;amp;vars;
 
   	options notes;
 
    	%put NOTE: Macro variables deleted.;
 
%mend deleteALL;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 16:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-a-Parameter-in-a-Program-in-EG/m-p/631637#M35682</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-03-12T16:56:08Z</dc:date>
    </item>
  </channel>
</rss>

