<?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 PROC STDRATE Error in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-STDRATE-Error/m-p/562159#M27843</link>
    <description>&lt;P&gt;Hi, I'm trying to use PROC STDRATE to get standardized mortality rates. I have two datasets, one of them being the reference dataset. I've tried to run the following code, but get various warning and error messages. I have no idea what I'm doing wrong, so any help would be great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdrate data = mort_rate_race
				refdata = ref_race
				method = direct
				stat = rate (mult = 100)
				effect = ratio
				plots(only) = effect
				;
	population event = total_death total = total_risk_period;
	reference total = total_pop;
	strata race_new / effect;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I get the following warning/error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: You must enable ODS graphics before requesting plots.
WARNING: The GROUP= option in the POPULATION statement is required for the EFFECT option. The option is not used.
WARNING: The stratum in the REFDATA= data set, race_new=	Asian, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Black, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Hispanic, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Other, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	White, does not have a matched stratum in the DATA= data set.
ERROR: The reference total is missing in the stratum race_new=Asian.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm not sure why, as I've looked at my two datasets and everything seems to be there. Here are the two datasets:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 563px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29833i30F1CC9F8C804161/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 05:28:48 GMT</pubDate>
    <dc:creator>bhong</dc:creator>
    <dc:date>2019-05-29T05:28:48Z</dc:date>
    <item>
      <title>PROC STDRATE Error</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-STDRATE-Error/m-p/562159#M27843</link>
      <description>&lt;P&gt;Hi, I'm trying to use PROC STDRATE to get standardized mortality rates. I have two datasets, one of them being the reference dataset. I've tried to run the following code, but get various warning and error messages. I have no idea what I'm doing wrong, so any help would be great!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdrate data = mort_rate_race
				refdata = ref_race
				method = direct
				stat = rate (mult = 100)
				effect = ratio
				plots(only) = effect
				;
	population event = total_death total = total_risk_period;
	reference total = total_pop;
	strata race_new / effect;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I get the following warning/error messages:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: You must enable ODS graphics before requesting plots.
WARNING: The GROUP= option in the POPULATION statement is required for the EFFECT option. The option is not used.
WARNING: The stratum in the REFDATA= data set, race_new=	Asian, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Black, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Hispanic, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	Other, does not have a matched stratum in the DATA= data set.
WARNING: The stratum in the REFDATA= data set, race_new=	White, does not have a matched stratum in the DATA= data set.
ERROR: The reference total is missing in the stratum race_new=Asian.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm not sure why, as I've looked at my two datasets and everything seems to be there. Here are the two datasets:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 563px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29833i30F1CC9F8C804161/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 05:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-STDRATE-Error/m-p/562159#M27843</guid>
      <dc:creator>bhong</dc:creator>
      <dc:date>2019-05-29T05:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: PROC STDRATE Error</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-STDRATE-Error/m-p/562219#M27844</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225184"&gt;@bhong&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not very familiar with PROC STDRATE, but a quick comparison with &lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_stdrate_examples01.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank" rel="noopener"&gt;Example 110.1 Comparing Directly Standardized Rates&lt;/A&gt; from the procedure documentation reveals an important difference: There, they compare &lt;EM&gt;two&lt;/EM&gt; populations (Alaska and Florida) which is why they need to standardize (using data for the U.S. as the reference population). Your MORT_RATE_RACE&amp;nbsp;dataset, however, contains data for only &lt;EM&gt;one&lt;/EM&gt; population. This means that all options involving "EFFECT" are not applicable because they apply "&lt;SPAN&gt;only when METHOD=DIRECT with two study populations ... are required" (&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_stdrate_syntax01.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en#statug.stdrate.effectopt" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;). So, you should delete or comment out the EFFECT= and PLOTS= options of the PROC STDRATE statement as well as the EFFECT option of the STRATA statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, you should make sure that the values in variable TOTAL_POP have the same unit (e.g. person-years) as those in variable TOTAL_RISK_PERIOD.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Moreover, you have a data issue: It looks like variable RACE_NEW in dataset REF_RACE contains tabs, leading blanks or other white space characters, which cause the mismatches mentioned in five of the warnings (e.g. &lt;FONT face="courier new,courier"&gt;'&amp;nbsp; &amp;nbsp;Asian'&lt;/FONT&gt; does not match &lt;FONT face="courier new,courier"&gt;'Asian'&lt;/FONT&gt;). So, you need to resolve these issues, e.g., with a DATA step like&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ref_race;
set ref_race;
race_new=compress(race_new,,'ka');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;or, even better, in the step that creates REF_RACE in the first place. If REF_RACE values in MORT_RATE_RACE also have leading blanks, you need to remove them in the same way.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Finally, to enable ODS graphics (for the implied default plot request PLOTS=RATE) use the &lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=p0kroq43yu0lspn16hk1u4c65lti.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;ODS GRAPHICS statement&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics;

proc stdrate data = mort_rate_race
    refdata = ref_race
    method = direct
    stat = rate (mult = 100)
    ;
  population event = total_death total = total_risk_period;
  reference total = total_pop; /* &amp;lt;-- please check the unit of TOTAL_POP */
  strata race_new;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;The above code should run without errors or warnings. It's your responsibility to check if the results make sense.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 10:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-STDRATE-Error/m-p/562219#M27844</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-05-29T10:34:33Z</dc:date>
    </item>
  </channel>
</rss>

