<?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: help w macro in combo w proc report in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/776191#M31357</link>
    <description>&lt;P&gt;At a high level you are going to need to know about&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0vl7e3du5f7cjn1g4ajozqxe6b6.htm" target="_self"&gt;Referencing Macro Variables Indirectly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1xhuzfc68jkhcn1xb0c4d5atq5e.htm" target="_self"&gt;%do statement&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Then you are going to do something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create macro to run reports */
/* runs parameter passes the number of runs */
%macro multiRep(runs) ;
	/* do loop to loop through the runs */
	%do i=1 %to &amp;amp;runs ;
		/* msg for the log */
		%put Run Report &amp;amp;i ;
		/* simple PROC PRINT example */
		proc print data=sashelp.class (obs=&amp;amp;i) ;
			title "Run Report &amp;amp;i" ;
		run ;
	%end ;
%mend ;

/* Run macro with 5 runs */
%multiRep(5) ;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Start simple and build up the macro little by little.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 13:40:10 GMT</pubDate>
    <dc:creator>AMSAS</dc:creator>
    <dc:date>2021-10-25T13:40:10Z</dc:date>
    <item>
      <title>help w macro in combo w proc report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/775909#M31341</link>
      <description>&lt;P&gt;I have 3 proc report statements that I need to run 25 times to get my desired result (one time for each "grantee"). I know there is a simple way to do this with a macro(?), but my experience with macros is limited and I'm struggling.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to run the following reports 25 times (1 for each value of the variable "grantee") - i.e., run the reports through once on a subset of data where grantee =grantee1, then run it through again where grantee=grantee2, etc. I have it set up in the code below with a %let statement - this works when i type the grantee name in, one by one, and run it 25 times.&amp;nbsp; I'm sure there's a faster way where it automatically runs through each value of grantee without having to change the %let statement. Any advice? (I feel like i'm missing something obvious and simple - thank you in advance!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**********************;&lt;/P&gt;&lt;P&gt;%let Q=2021 Q2;&amp;nbsp; *MUST CHANGE EVERY QUARTER - reporting quarter;&lt;/P&gt;&lt;P&gt;%let D=11/30/2021; *MUST CHANGE EVERY QUARTER - end of the current quarter;&lt;/P&gt;&lt;P&gt;%let G=GRANTEE1; *would need to run for each grantee, 25 total - how to omit this statement and instead use a macro ?;&lt;/P&gt;&lt;P&gt;**********************;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*incorporate a macro so these 7 reports will run 25 times - once per value of grantee - without typing in the values of the grantee;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; granteereport (??);&lt;/P&gt;&lt;P&gt;*******************************************************************************************;&lt;/P&gt;&lt;P&gt;*REPORT 1 of 7 - Strategy 1&amp;nbsp; Activities, Training, Outcomes;&lt;/P&gt;&lt;P&gt;ods rtf file = "P:\Shared\Reports\&lt;STRONG&gt;&amp;amp;G&lt;/STRONG&gt;._&amp;amp;Q..rtf" startpage=no;&lt;/P&gt;&lt;P&gt;Title1 "2021-2026 &lt;STRONG&gt;&amp;amp;G&lt;/STRONG&gt; Report";&lt;/P&gt;&lt;P&gt;Title2 "6/1/2021 - &amp;amp;D";&lt;/P&gt;&lt;P&gt;**1a.;&lt;/P&gt;&lt;P&gt;proc report data=convert;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where grantee="&amp;amp;G"&lt;/STRONG&gt; and FW_Idname ne '';&lt;/P&gt;&lt;P&gt;column ("Site Level Activities, Training and Technical Assistance" FW_IDname ("Key Activities" nFWA_B01-nFWA_B03) ("Training and Technical Assistance - Year 1" ("Nutrition" nFWT_N11-nFWT_N14 )&amp;nbsp;("Physical Activity" nFWT_P11-nFWT_P14) ));&lt;/P&gt;&lt;P&gt;define FW_idname / group display&amp;nbsp; "Worksite ID|Name";&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWA_B01 / analysis sum "Recruited, ID'd Partners" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWA_B02 / analysis sum "Assessed" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWA_B03 / analysis sum "ID'd Areas for Improvement" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_N11 / analysis sum "Cafeterias" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_N12 / analysis sum "Vending" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_N13 / analysis sum "Snack Bars" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_N14 / analysis sum "Behavioral Design" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_P11 / analysis sum "Policy" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_P12 / analysis sum "Environmental Supports" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_P13 / analysis sum "Walking Program" center format=check.;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWT_P14 / analysis sum "Activity Friendly Routes" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rbreak after /summarize&amp;nbsp; dol ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compute after ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FW_idname='Total';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define&amp;nbsp; (_row_, "style", "STYLE=[font_weight=bold]")&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;2&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;3&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;4&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;5&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;6&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;7&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;8&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;9&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;10&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;11&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;12&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;** 1b.OUTCOMES;&lt;/P&gt;&lt;P&gt;proc report data=convert;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where grantee="&amp;amp;G"&lt;/STRONG&gt; and FW_idname ne '';&lt;/P&gt;&lt;P&gt;column ("Site Level Outcomes" FW_IDname ("Nutrition Outcomes" nFWO_N05 ("FSGs Implemented in" nFWO_N02-nFWO_N04) ) ("Physical Activity Outcomes" nFWO_P01 ("Practice Implemented" nFWO_P02-nFWO_P04)));&lt;/P&gt;&lt;P&gt;define FW_idname / group display "Worksite ID|Name" center;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_N02 / analysis sum "Cafeterias" center format=check.;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_N03 / analysis sum "Vending Machines" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_N04 / analysis sum "Snack Bars" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_N05 / analysis sum "Behavioral Design Practice Implemented" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_P01&amp;nbsp;&amp;nbsp; / analysis sum "Policy Adopted/Improved" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_P02/ analysis sum "Environmental Support" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_P03 / analysis sum "Walking Program" center format=check.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; define nFWO_P04 / analysis sum "Activity Friendly Route" center format=check.;&lt;/P&gt;&lt;P&gt;rbreak after/summarize&amp;nbsp; dol ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compute after;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FW_idname='Total';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define (_row_, "style", "STYLE=[font_weight=bold]");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;2&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;3&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;4&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;5&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;6&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;7&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;8&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp; call define (&lt;STRONG&gt;9&lt;/STRONG&gt;,"format","3.");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**1c.NARRATIVE;&lt;/P&gt;&lt;P&gt;proc report data=convert;&lt;/P&gt;&lt;P&gt;column&amp;nbsp; FW_nar;&lt;/P&gt;&lt;P&gt;define FW_nar / display "&amp;amp;Q Narrative";&lt;/P&gt;&lt;P&gt;where FW_Nar ne "" and &lt;STRONG&gt;grantee="&amp;amp;G";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;*where quarter= "&amp;amp;Q";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;*ods rtf close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt; granteereport;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%granteereport (??)&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 16:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/775909#M31341</guid>
      <dc:creator>mmurph15</dc:creator>
      <dc:date>2021-10-22T16:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: help w macro in combo w proc report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/775916#M31343</link>
      <description>&lt;P&gt;Look up CALL EXECUTE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See Step 5/6 here:&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;</description>
      <pubDate>Fri, 22 Oct 2021 16:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/775916#M31343</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-22T16:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: help w macro in combo w proc report</title>
      <link>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/776191#M31357</link>
      <description>&lt;P&gt;At a high level you are going to need to know about&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n0vl7e3du5f7cjn1g4ajozqxe6b6.htm" target="_self"&gt;Referencing Macro Variables Indirectly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1xhuzfc68jkhcn1xb0c4d5atq5e.htm" target="_self"&gt;%do statement&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Then you are going to do something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create macro to run reports */
/* runs parameter passes the number of runs */
%macro multiRep(runs) ;
	/* do loop to loop through the runs */
	%do i=1 %to &amp;amp;runs ;
		/* msg for the log */
		%put Run Report &amp;amp;i ;
		/* simple PROC PRINT example */
		proc print data=sashelp.class (obs=&amp;amp;i) ;
			title "Run Report &amp;amp;i" ;
		run ;
	%end ;
%mend ;

/* Run macro with 5 runs */
%multiRep(5) ;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Start simple and build up the macro little by little.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 13:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/help-w-macro-in-combo-w-proc-report/m-p/776191#M31357</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-10-25T13:40:10Z</dc:date>
    </item>
  </channel>
</rss>

