<?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: Macro Footnote Question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633633#M187968</link>
    <description>&lt;P&gt;But the code you posted has neither a BY statement nor any use of the #BYVAL() tag.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table hw3.actorS as
  select id, title, actor
       , count(title) as movies
       , avg(popularity) as pop
       , count(awards) as awardnum
from hw3.films3
group by id
order by id
;
quit;

proc print data=hw3.actorS;
  by id actor movies pop awardnum;
  pageby id;
  var title;
title "Actor Name: #byval(actor)";
footnote "Movies #byval(movies) Popularity #byval(pop) Awards #byval(awardnum)";
run;
title;
footnote;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Notice that there is no need for defining a macro or for using any macro varaibles.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2020 14:54:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-03-20T14:54:14Z</dc:date>
    <item>
      <title>Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633603#M187954</link>
      <description>&lt;P&gt;How do I create the macros I want to use in the footnote described below if I want to base the macros on the values of the movies, pop, and awardnum variables? Is this possible or is there another way to create a footnote with the values of those variables? I tries #BYVAR and #BYVAL also and it didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table hw3.actor as&lt;/P&gt;&lt;P&gt;select id, title, actor,&lt;FONT color="#0000FF"&gt; count(title) as movies, avg(popularity) as pop, count(awards) as awardnum&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;from hw3.films3&lt;/P&gt;&lt;P&gt;where id=&amp;amp;id;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data=hw3.actor;&lt;/P&gt;&lt;P&gt;where id=&amp;amp;id;&lt;/P&gt;&lt;P&gt;var title;&lt;/P&gt;&lt;P&gt;title "Actor Name: &amp;amp;actor10";&lt;/P&gt;&lt;P&gt;footnote "&lt;FONT color="#0000FF"&gt;&amp;amp;movies &amp;amp;pop &amp;amp;awardnum&lt;/FONT&gt;";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633603#M187954</guid>
      <dc:creator>matoma</dc:creator>
      <dc:date>2020-03-20T14:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633606#M187955</link>
      <description>&lt;P&gt;I can't try this without your data, but it seems like your SQL isn't right. It seems like you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;group by id,title,actor&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in your SQL in order to get the counts and averages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, when you print BY ID; the variables #BYVAL and #BYVAR ought to work.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633606#M187955</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-20T14:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633618#M187961</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 750px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37100i0596D9F2A95D6977/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My proc sql is giving me kind of what I want in the sense that it has the total number of movies, the average popularity, and the number of awards. Its just showing up 7 times for each movie title and id. I guess what I'm trying to do is take the values of 7 for movies, 57.28 for pop and 7 for awards and put it into a footnote.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633618#M187961</guid>
      <dc:creator>matoma</dc:creator>
      <dc:date>2020-03-20T14:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633619#M187962</link>
      <description>&lt;P&gt;Take a look at&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&amp;nbsp;'s answer to your question yesterday.&amp;nbsp; His first code block shows how to use SQL into:&amp;nbsp; to create macro vars.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Macro-Beginner/m-p/633338" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Macro-Beginner/m-p/633338&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633619#M187962</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2020-03-20T14:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633622#M187965</link>
      <description>&lt;P&gt;Yes, but if you do the PROC PRINT with the BY statement, then FOOTNOTE with #BYVAR and #BYVAL works fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;by id movies pop awardnum;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633622#M187965</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-20T14:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Footnote Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633633#M187968</link>
      <description>&lt;P&gt;But the code you posted has neither a BY statement nor any use of the #BYVAL() tag.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table hw3.actorS as
  select id, title, actor
       , count(title) as movies
       , avg(popularity) as pop
       , count(awards) as awardnum
from hw3.films3
group by id
order by id
;
quit;

proc print data=hw3.actorS;
  by id actor movies pop awardnum;
  pageby id;
  var title;
title "Actor Name: #byval(actor)";
footnote "Movies #byval(movies) Popularity #byval(pop) Awards #byval(awardnum)";
run;
title;
footnote;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;Notice that there is no need for defining a macro or for using any macro varaibles.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Footnote-Question/m-p/633633#M187968</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T14:54:14Z</dc:date>
    </item>
  </channel>
</rss>

