<?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: marco variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509970#M1858</link>
    <description>&lt;P&gt;it's not homework. The macro doesn't have to be there. I was just trying a few different ways. I just can't seem to get the names of the teachers and locations to change.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Nov 2018 17:13:40 GMT</pubDate>
    <dc:creator>chrissowden</dc:creator>
    <dc:date>2018-11-02T17:13:40Z</dc:date>
    <item>
      <title>marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509747#M1817</link>
      <description>&lt;P&gt;I am trying to do the following but I can not get the location begin_date or teacher to chance when the %let crsnum changes. the location begin_date and teacher are stuck with the same info.&lt;BR /&gt;&lt;BR /&gt;/**picking a course number, print out the roster for the course with:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Location, start date and teacher's name in the title(s)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Number paid out of total registered and outstanding fees due in the footer***/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;**Datasets used are mysas.register schedule courses**;&lt;BR /&gt;&lt;BR /&gt;%let crsnum=13;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;%macro ex1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;data revenue;&lt;BR /&gt;&amp;nbsp;set mysas.register end=final;&lt;BR /&gt;&amp;nbsp;where course_number=&amp;amp;crsnum;&lt;BR /&gt;&amp;nbsp;total+1;&lt;BR /&gt;&amp;nbsp;if paid='Y' then paidup+1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;if final then do;&lt;BR /&gt;&amp;nbsp; put total= paidup=;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; if paidup &amp;lt; total then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let foot=Outstanding fees due;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; else do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let foot=Number paid out of total registered;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%if &amp;amp;crsnum %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('loc',location);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put &amp;amp;loc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('date',put(begin_date,date9.));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put&amp;nbsp; &amp;amp;date;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('teach',teacher);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put&amp;nbsp; &amp;amp;teach;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;Title "&amp;amp;loc &amp;amp;date &amp;amp;teach";&lt;BR /&gt;proc print data=mysas.register noobs;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where course_number=&amp;amp;crsnum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;footnote "&amp;amp;foot";&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%ex1;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 00:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509747#M1817</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T00:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509749#M1819</link>
      <description>Couple of quick questions to start, does your code work without macro logic? Which part specifically are you having issues with? Can you provide the sample data as well to support working on this question.</description>
      <pubDate>Fri, 02 Nov 2018 00:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509749#M1819</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-02T00:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509750#M1820</link>
      <description>&lt;P&gt;In general, this is a pretty robust approach for creating a macro, but it does require working code. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just some quick comments on your code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You should combine some of the data _null_ steps&lt;/LI&gt;
&lt;LI&gt;Use CALL SYMPUTX() instead of CALL SYMPUT()&lt;/LI&gt;
&lt;LI&gt;If you're not filtering the 'schedule data set' how are you sure it's the correct data since it likely has more than one value?&lt;/LI&gt;
&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/130109"&gt;@chrissowden&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to do the following but I can not get the location begin_date or teacher to chance when the %let crsnum changes. the location begin_date and teacher are stuck with the same info.&lt;BR /&gt;&lt;BR /&gt;/**picking a course number, print out the roster for the course with:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Location, start date and teacher's name in the title(s)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Number paid out of total registered and outstanding fees due in the footer***/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;**Datasets used are mysas.register schedule courses**;&lt;BR /&gt;&lt;BR /&gt;%let crsnum=13;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;%macro ex1;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;data revenue;&lt;BR /&gt;&amp;nbsp;set mysas.register end=final;&lt;BR /&gt;&amp;nbsp;where course_number=&amp;amp;crsnum;&lt;BR /&gt;&amp;nbsp;total+1;&lt;BR /&gt;&amp;nbsp;if paid='Y' then paidup+1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;if final then do;&lt;BR /&gt;&amp;nbsp; put total= paidup=;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; if paidup &amp;lt; total then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let foot=Outstanding fees due;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; else do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let foot=Number paid out of total registered;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%if &amp;amp;crsnum %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('loc',location);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put &amp;amp;loc;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('date',put(begin_date,date9.));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put&amp;nbsp; &amp;amp;date;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;data _null_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; call symput('teach',teacher);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%put&amp;nbsp; &amp;amp;teach;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;Title "&amp;amp;loc &amp;amp;date &amp;amp;teach";&lt;BR /&gt;proc print data=mysas.register noobs;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where course_number=&amp;amp;crsnum;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;footnote "&amp;amp;foot";&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%ex1;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 00:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509750#M1820</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-02T00:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509756#M1822</link>
      <description>&lt;P&gt;yes my code works but the location begin date and teacher doesn't change&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 01:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509756#M1822</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T01:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509759#M1823</link>
      <description>&lt;P&gt;There is nothing about your code that would ever change the value of those macro variables:&amp;nbsp; &amp;amp;LOC, &amp;amp;DATE, and &amp;amp;TEACH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They all come from the final observation in MYSAS.SCHEDULE.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's probably not what you intended, but it's difficult to be sure.&amp;nbsp; We have to rely on you to supply that piece.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, %LET statements are never part of a DATA step.&amp;nbsp; IF THEN statements do not affect whether or not they execute.&amp;nbsp; If you want &amp;amp;FOOT to depend on conditions in the DATA step, use CALL SYMPUTX instead of %LET:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if paidup &amp;lt; total then do;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; call symputx('foot', 'Outstanding fees due');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;They way the code stands now, you might as well take both %LET statements:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let foot=Outstanding fees due;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let foot=Number paid out of total registered;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Since they're not part of the DATA step, just place them before the DATA step begins (and remove them from the DATA step itself).&amp;nbsp; That's actually the order in which the statements execute.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 01:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509759#M1823</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-02T01:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509829#M1839</link>
      <description>&lt;P&gt;That's the section of the code that I know is not working correctly. The current code will keep the &amp;amp;loc &amp;amp;date &amp;amp;teach the same even if the course number changes. I want the macro variables to change when I choose a different course number&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 12:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509829#M1839</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T12:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509844#M1844</link>
      <description>&lt;P&gt;So how do you know which values you want to extract from MYSAS.SCHEDULE?&amp;nbsp; If there is just one observation per course number, and if you want to select the values that match, you could add a WHERE statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data _null_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set mysas.schedule;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where course_number = &amp;amp;crsnum;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call symput('teach',teacher);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 13:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509844#M1844</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-02T13:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509868#M1847</link>
      <description>&lt;P&gt;Why is this coded as a macro?&amp;nbsp; There is no conditional logic that could not be handled via data step logic. The macro has no input parameters defined.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let crsnum=13;    

data revenue;
  set mysas.register end=final;
  where course_number=&amp;amp;crsnum;
  total+1;
  if paid='Y' then paidup+1;
  if final then do;
    put total= paidup=;
    if paidup &amp;lt; total then call symputx('foot','Outstanding fees due');
    else call symputx('foot','Number paid out of total registered');
  end;
run;

data _null_;
  set mysas.schedule;
  if &amp;amp;crsnum then do;
    call symputx('loc',location);
    call symputx('date',put(begin_date,date9.));
    call symputx('teach',teacher);
  end;
run;

%put &amp;amp;=loc &amp;amp;=date &amp;amp;=teach;
%put &amp;amp;=foot;

title "&amp;amp;loc &amp;amp;date &amp;amp;teach";
footnote "&amp;amp;foot";
proc print data=mysas.register noobs;
  where course_number=&amp;amp;crsnum;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But shouldn't the IF test in the data _null_ step really be more like the WHERE statement in the first data step?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 13:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509868#M1847</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-02T13:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509894#M1848</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Why is this coded as a macro?&amp;nbsp; There is no conditional logic that could not be handled via data step logic. The macro has no input parameters defined.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Because it's homework &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:53:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509894#M1848</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-02T14:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509970#M1858</link>
      <description>&lt;P&gt;it's not homework. The macro doesn't have to be there. I was just trying a few different ways. I just can't seem to get the names of the teachers and locations to change.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 17:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509970#M1858</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T17:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509974#M1860</link>
      <description>&amp;gt;If you're not filtering the 'schedule data set' how are you sure it's the correct data since it likely has more than one value? &lt;BR /&gt;&lt;BR /&gt;You were using the schedule data set and having call symput execute on every row. We can't see that data but I'm guessing it needed to be filtered, you can see that's what Tom did in his code. If his solution doesn't work, post back with the log and details.</description>
      <pubDate>Fri, 02 Nov 2018 17:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509974#M1860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-02T17:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509995#M1867</link>
      <description>&lt;P&gt;here is the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 %let crsnum=6;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 data revenue;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 set mysas.register end=final;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 where course_number=&amp;amp;crsnum;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 total+1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 if paid='Y' then paidup+1;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 if final then do;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 put total= paidup=;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 if paidup &amp;lt; total then call symputx('foot','Outstanding fees due');&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83 else call symputx('foot','Number paid out of total registered');&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 end;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;85 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;total=27 paidup=17&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 27 observations read from the data set MYSAS.REGISTER.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;WHERE course_number=6;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.REVENUE has 27 observations and 5 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.34 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;86&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;87 data _null_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;88 set mysas.schedule;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;89 where (&amp;amp;crsnum );&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;90 call symputx('loc',location);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;91 call symputx('date1',put(begin_date,date9.));&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;92 call symputx('teach',teacher);&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;93&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;94 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 18 observations read from the data set MYSAS.SCHEDULE.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;WHERE 6 /* an obviously TRUE WHERE clause */ ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.18 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;95&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;96 %put &amp;amp;=loc &amp;amp;=date1 &amp;amp;=teach;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;LOC=Dallas DATE1=25MAR2002 TEACH=Berthan, Ms. Judy&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;97&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;98&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;99&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;100 %put &amp;amp;=foot;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;FOOT=Outstanding fees due&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;101 title "&amp;amp;loc &amp;amp;date &amp;amp;teach";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;102 footnote "&amp;amp;foot";&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;103 proc print data=mysas.register noobs;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;104 where course_number=&amp;amp;crsnum;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;105 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 27 observations read from the data set MYSAS.REGISTER.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;WHERE course_number=6;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.07 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.06 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;106&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;107 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;120&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Nov 2018 18:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509995#M1867</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T18:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: marco variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509997#M1868</link>
      <description>&lt;P&gt;THanks... it was the where clause that fixed the problem. Thank you!!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 18:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/marco-variables/m-p/509997#M1868</guid>
      <dc:creator>chrissowden</dc:creator>
      <dc:date>2018-11-02T18:14:02Z</dc:date>
    </item>
  </channel>
</rss>

