<?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 Help changing missing value to the row mean in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844219#M36675</link>
    <description>&lt;P&gt;I am trying to write code to handle missing items from survey data. The survey is the AM-PAC outpatient basic mobility (contains 18 questions), and per the survey instructions, to score surveys with missing data, you are supposed to find the average score for the survey's non-missing items, and then input that average score for the missing items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snapshot of my data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rauzim_0-1668462744853.png" style="width: 694px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77293i10ED82C80E18D468/image-dimensions/694x85?v=v2" width="694" height="85" role="button" title="rauzim_0-1668462744853.png" alt="rauzim_0-1668462744853.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So you can see in obs 5 (pid SP_002), there are 3 missing items (highlighted in yellow); I've added a variable for the row mean (ampac_mean), and this rows mean is the value highlighted in yellow in the last column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I input that value (2.13) for the missing items in that row?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have additional rows with missing data so I will need to be able to input that row's mean value into the missing items.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Michelle&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 21:56:22 GMT</pubDate>
    <dc:creator>rauzim</dc:creator>
    <dc:date>2022-11-14T21:56:22Z</dc:date>
    <item>
      <title>Help changing missing value to the row mean</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844219#M36675</link>
      <description>&lt;P&gt;I am trying to write code to handle missing items from survey data. The survey is the AM-PAC outpatient basic mobility (contains 18 questions), and per the survey instructions, to score surveys with missing data, you are supposed to find the average score for the survey's non-missing items, and then input that average score for the missing items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a snapshot of my data:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rauzim_0-1668462744853.png" style="width: 694px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77293i10ED82C80E18D468/image-dimensions/694x85?v=v2" width="694" height="85" role="button" title="rauzim_0-1668462744853.png" alt="rauzim_0-1668462744853.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So you can see in obs 5 (pid SP_002), there are 3 missing items (highlighted in yellow); I've added a variable for the row mean (ampac_mean), and this rows mean is the value highlighted in yellow in the last column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I input that value (2.13) for the missing items in that row?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have additional rows with missing data so I will need to be able to input that row's mean value into the missing items.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Michelle&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 21:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844219#M36675</guid>
      <dc:creator>rauzim</dc:creator>
      <dc:date>2022-11-14T21:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help changing missing value to the row mean</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844298#M36681</link>
      <description>Hello! &lt;BR /&gt;As it appears to me that you do not want to calculate the values yourself, why not having an array of values and looping over it ... checking for . ?&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 15 Nov 2022 08:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844298#M36681</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-15T08:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help changing missing value to the row mean</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844310#M36682</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.TestData;
	input Test09-Test11 Mean;
	datalines;
	1 2 3 2
	. 4 5 4.5
	6 . 8 7
	8 9 . .
	;
run;

data work.TestDataImputed;
	set work.TESTDATA;
	array Cols(*) Test09-Test11;
	
	if not missing(Mean) then do;
		/* Loop over cols */
		do i=1 to dim(Cols);
			if missing(Cols(i)) then Cols(i) = Mean;
		end;
	end;	
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or something similar ...&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2022 09:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Help-changing-missing-value-to-the-row-mean/m-p/844310#M36682</guid>
      <dc:creator>fja</dc:creator>
      <dc:date>2022-11-15T09:44:58Z</dc:date>
    </item>
  </channel>
</rss>

