<?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: Impute missing value with mean of other available variable values if one of them is missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938033#M368508</link>
    <description>&lt;P&gt;Transpose the dataset to long, and use BY in the procedure.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2024 22:42:07 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-08-01T22:42:07Z</dc:date>
    <item>
      <title>Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938007#M368496</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 10 variables v1 v2 v3 v4 v5 v6 v7 v8 v9 v10. I want to assign mean of others when one of them is missing. I am uisng below code but it looks like it is not working. Can you please help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc stdize data=have reponly method=mean out=want;
	var v1-v10;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Aug 2024 20:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938007#M368496</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2024-08-01T20:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938009#M368497</link>
      <description>&lt;P&gt;Where is usable example data in a DATA step with DATALINES?&lt;/P&gt;
&lt;P&gt;Where is the log?&lt;/P&gt;
&lt;P&gt;Where is a clear description why the outcome does not meet your expectations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We really should not need to ask for this from a user with 147 posts here.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 20:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938009#M368497</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-01T20:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938015#M368499</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/117414"&gt;@chinna0369&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have 10 variables v1 v2 v3 v4 v5 v6 v7 v8 v9 v10. I want to assign mean of others when one of them is missing. I am uisng below code but it looks like it is not working. Can you please help me with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc stdize data=have reponly method=mean out=want;
	var v1-v10;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What exactly is "mean of others" in terms of calculations?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you show tells SAS to replace the missing values of each variable with mean of that variable.&lt;/P&gt;
&lt;P&gt;Example small data set:&lt;/P&gt;
&lt;PRE&gt;data have;
  input obs v1 v2;
datalines;
1   1   .
2   1   2
3   1   3
4   1   4
5   1   5
6   .   6
7   1   7
8   1   8
9   1   9
10  1   10
;

Proc stdize data=have reponly method=mean out=want;
   var v1 v2;
run;&lt;/PRE&gt;
&lt;P&gt;This imputes a value of 1 for variable V1 on obs 6 and for V2 on obs 1 imputes 6.&lt;/P&gt;
&lt;P&gt;What values would you want given your " mean of others " rule?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 21:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938015#M368499</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-01T21:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938019#M368501</link>
      <description>&lt;P&gt;Sorry, for not giving proper details. Below is the data and procedure I am using result should be mean for missing variable which is 1/8=0.125 here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input id 1-2 visitn 3-7 v1 v2 v3 v4 v5 v6 v7 v8 v9;
datalines;
1 1320 0 0 . 0 0 0 0 0 1 0
2 1160 0 . 0 1 0 0 0 0 0 0
;
run;

proc stdize data=have reponly method=mean out=want;
	var v1 v2 v3 v4 v5 v6 v7 v8 v9;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Aug 2024 21:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938019#M368501</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2024-08-01T21:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938024#M368503</link>
      <description>&lt;P&gt;And this is my log:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chinna0369_0-1722548903227.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98968i53B6DB00093C456C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chinna0369_0-1722548903227.png" alt="chinna0369_0-1722548903227.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 21:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938024#M368503</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2024-08-01T21:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938025#M368504</link>
      <description>&lt;P&gt;Not a job for Stdize. Your rule is observation based not variable across observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array v (*) v1-v9;
   /* calculate the mean of the values present before
      changing any of them
   */
   replacement = mean (of v(*));
   /* replace the missing values with the replacement value*/
   do i=1 to dim(v);
      if missing(v[i]) then v[i]=replacement;
   end;
   drop replacement;
run;&lt;/PRE&gt;
&lt;P&gt;Arrays are often indicated as a choice when doing similar things to multiple variables.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 21:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938025#M368504</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-01T21:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938029#M368506</link>
      <description>&lt;P&gt;CALL STDIZE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input id avisitn v1 v2 v3 v4 v5 v6 v7 v8 v9;
   call stdize('none','replace','missing=',mean(of v:),of v:);
   datalines;
1 1320 0 0 . 0 0 0 0 0 1 0
2 1160 0 . 0 1 0 0 0 0 0 0
;
   run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 355px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98969iD1DF27396D210DAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 22:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938029#M368506</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2024-08-01T22:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938031#M368507</link>
      <description>Thank you so much for your solution.</description>
      <pubDate>Thu, 01 Aug 2024 22:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938031#M368507</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2024-08-01T22:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Impute missing value with mean of other available variable values if one of them is missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938033#M368508</link>
      <description>&lt;P&gt;Transpose the dataset to long, and use BY in the procedure.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 22:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Impute-missing-value-with-mean-of-other-available-variable/m-p/938033#M368508</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-01T22:42:07Z</dc:date>
    </item>
  </channel>
</rss>

