<?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 Loop multiple data using proc stdrate in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Loop-multiple-data-using-proc-stdrate/m-p/599964#M16555</link>
    <description>&lt;P&gt;Hello. Can anyone help with the following report. I would like to create as the attached report by using from 1 to multiple data-sets the following macro parameters which are unique for each data-set:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc stdrate data=&amp;amp;DATA (data 1 and data 2).&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;refdata=&amp;amp;REFDATA (data 1a and data 2a).&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;method=direct&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;stat=rate (mult=100000);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;population event=&amp;amp;EVENTS (for data 1 it is cancer 1 and for data 2 it is cancer 2) total=&amp;amp;POPULATION. (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;there are 2 different&amp;nbsp; variables from data-sets (data 1a and data 2a));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; reference total=&amp;amp;REF_TOTAL. (variable female from data&amp;nbsp; 1a and overall from data 2a) ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; strata agegroup;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; by &amp;amp;COHORTS (in the example, those are gender and race) notsorted;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ods output StdRate=StdRate;&lt;/P&gt;&lt;P&gt;quit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2019 02:10:34 GMT</pubDate>
    <dc:creator>Emma8</dc:creator>
    <dc:date>2019-10-29T02:10:34Z</dc:date>
    <item>
      <title>Loop multiple data using proc stdrate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Loop-multiple-data-using-proc-stdrate/m-p/599964#M16555</link>
      <description>&lt;P&gt;Hello. Can anyone help with the following report. I would like to create as the attached report by using from 1 to multiple data-sets the following macro parameters which are unique for each data-set:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc stdrate data=&amp;amp;DATA (data 1 and data 2).&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;refdata=&amp;amp;REFDATA (data 1a and data 2a).&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;method=direct&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;stat=rate (mult=100000);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;population event=&amp;amp;EVENTS (for data 1 it is cancer 1 and for data 2 it is cancer 2) total=&amp;amp;POPULATION. (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;there are 2 different&amp;nbsp; variables from data-sets (data 1a and data 2a));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; reference total=&amp;amp;REF_TOTAL. (variable female from data&amp;nbsp; 1a and overall from data 2a) ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; strata agegroup;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; by &amp;amp;COHORTS (in the example, those are gender and race) notsorted;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ods output StdRate=StdRate;&lt;/P&gt;&lt;P&gt;quit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 02:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Loop-multiple-data-using-proc-stdrate/m-p/599964#M16555</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2019-10-29T02:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Loop multiple data using proc stdrate</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Loop-multiple-data-using-proc-stdrate/m-p/599970#M16556</link>
      <description>&lt;P&gt;Get the code to work for one set of values (datasets, variables etc).&lt;/P&gt;
&lt;P&gt;Then change the variable part to use macro variable references (which is kind of like your posted pseudo code).&amp;nbsp; Just set the macro variable values with %LET statements at the top.&amp;nbsp; Get that to work for the same example values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let data=data1;
%let refdata=data1a;
....
proc stdrate 
  data=&amp;amp;data
  refdata=&amp;amp;refdata
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then remove the %LET statements and wrap the code into a macro using the names of those macro variables as the parameters to the macro. Convert the %LET statements into the values of the macro in the call to the macro.&amp;nbsp; Again get that to work for your example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mystdrate
(data=
,refdata=
...
);
proc stdrate 
  data=&amp;amp;data
  refdata=&amp;amp;refdata
...

%mend;

%mystdrate
(data=data1
,refdata=data1a
...
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then just call the macro multiple times with each of your combinations of values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mystdrate
(data=data2
,refdata=data2a
...
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you actually have the list of values in a dataset then you can use the dataset to generate the calls.&amp;nbsp; But if you don't have the dataset it is not really worth making it. Just write the individual macro calls.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 02:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Loop-multiple-data-using-proc-stdrate/m-p/599970#M16556</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-29T02:59:05Z</dc:date>
    </item>
  </channel>
</rss>

