<?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: How do I impute missing values based on two grouping variables? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278292#M14675</link>
    <description>&lt;P&gt;If you have data for those records make a 'master table' that has the values for the drug/year and then merge the tables on drug/year.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can probably use PROC STANDARD for this to replace missing values, as long as you're okay with using the mean value of the drugs per year. If not you'll need another method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473725.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473725.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2016 19:05:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-17T19:05:08Z</dc:date>
    <item>
      <title>How do I impute missing values based on two grouping variables?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278255#M14671</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have missing values in cost variable. &amp;nbsp;I would like to impute the missing values, grouped by two variables. &amp;nbsp;My data structure looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DrugName&lt;/TD&gt;&lt;TD&gt;RX_Yr&lt;/TD&gt;&lt;TD&gt;Cost;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 1&lt;/TD&gt;&lt;TD&gt;2010&lt;/TD&gt;&lt;TD&gt;$50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 1&lt;/TD&gt;&lt;TD&gt;2010&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 1&lt;/TD&gt;&lt;TD&gt;2011&lt;/TD&gt;&lt;TD&gt;$60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 2&lt;/TD&gt;&lt;TD&gt;2010&lt;/TD&gt;&lt;TD&gt;$30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 2&lt;/TD&gt;&lt;TD&gt;2010&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Drug 2&lt;/TD&gt;&lt;TD&gt;2011&lt;/TD&gt;&lt;TD&gt;$20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using Proc MI like this:&lt;/P&gt;&lt;P&gt;proc mi data=Have&amp;nbsp;out=have_impute&lt;BR /&gt;by DrugName&amp;nbsp;Rx_yr;&lt;BR /&gt;var Cost;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it returns an error message of "Fewer than two analysis variables". &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone know what I am doing wrong, or a better way to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 17:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278255#M14671</guid>
      <dc:creator>cbatzi01</dc:creator>
      <dc:date>2016-06-17T17:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values based on two grouping variables?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278264#M14672</link>
      <description>&lt;P&gt;Maybe you should avoid 'drugname' as the analysis variable since it is character variable.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278264#M14672</guid>
      <dc:creator>learner</dc:creator>
      <dc:date>2016-06-17T18:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values based on two grouping variables?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278280#M14673</link>
      <description>&lt;P&gt;I'm not sure that's a good way to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd consider some rules that are probably true 90% of the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example for drug1 in the same year I would assume the same price.&lt;/P&gt;
&lt;P&gt;If I don't have data for that year, then I would consider an interpolation method, probably something as simple as the average of the years before and after. You probably have some more complex scenarios, such as missing two years in a row or different prices in same year. Regardless, I don't think a straighforward imputation method would be the best way to go in your case. This is assuming you're actually working with drug data and not some other data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 18:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278280#M14673</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-17T18:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values based on two grouping variables?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278289#M14674</link>
      <description>I am working with insurance claims data. I have over 900K records, 5% are missing the cost data. The costs vary a little depening on the patients insurance type, but not much. I definitely have data for a given year, just not sure how to systematically make the updates, other than hardcoding a value like&lt;BR /&gt;&lt;BR /&gt;if DrugNm=Drug 1 and Rx_year=2010 and Cost=. then Cost=X;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Jun 2016 19:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278289#M14674</guid>
      <dc:creator>cbatzi01</dc:creator>
      <dc:date>2016-06-17T19:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I impute missing values based on two grouping variables?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278292#M14675</link>
      <description>&lt;P&gt;If you have data for those records make a 'master table' that has the values for the drug/year and then merge the tables on drug/year.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can probably use PROC STANDARD for this to replace missing values, as long as you're okay with using the mean value of the drugs per year. If not you'll need another method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473725.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473725.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 19:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-do-I-impute-missing-values-based-on-two-grouping-variables/m-p/278292#M14675</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-17T19:05:08Z</dc:date>
    </item>
  </channel>
</rss>

