<?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 to fill in missing values for one variable by group/other var (if all other values are the s in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779425#M248223</link>
    <description>Thank you again. That works but I'm getting one more error with the "group by icd_grp;" statement...and thought perhaps because it's not reading my dataset. How do I point to my dataset in this code? Truly appreciate this - I'm a beginner and need to take more classes. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Tue, 09 Nov 2021 21:02:48 GMT</pubDate>
    <dc:creator>Clo13</dc:creator>
    <dc:date>2021-11-09T21:02:48Z</dc:date>
    <item>
      <title>How to fill in missing values for one variable by group/other var (if all other values are the same)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779411#M248214</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to complete a mapping of ICD10 codes to conditions by filling in missing values for variable "condition". I've created a variable icd10_grp that will identify groups of codes (by their first three digits). Within these groups I want to fill in the missing condition value with one of the present values (for condition) in the same group but ONLY when all the values in the group are the same. I've tried to use the update statement and that works when the missing value is not the first one (but doesn't discern if all values in group are the same). I've also tried coalesce function and it runs without error but the new column is still blank (and it doesn't&amp;nbsp;discern if all values in group are the same either). How can I adjust the programming to identify all same values of condition within a group and then use that value to replace the missing one?&lt;/P&gt;&lt;P&gt;Thank you.&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="icd10 mapping to conditions" style="width: 604px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65531iC60141F781B763A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="icd10 map.png" alt="icd10 mapping to conditions" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;icd10 mapping to conditions&lt;/span&gt;&lt;/span&gt;&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="prog.png" style="width: 867px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65533i98EB29F3040E3FE8/image-size/large?v=v2&amp;amp;px=999" role="button" title="prog.png" alt="prog.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Product: Base SAS via Enterprise Guide 8.2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Release: 9.04.01 M6P110718&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;OS: Linux&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 20:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779411#M248214</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T20:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779413#M248216</link>
      <description>&lt;P&gt;SQL is usually easier. &lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, 
case when max(condition)=min(condition) then 'Constant' 
else 'Mixed' 
end as cond_status, 
case when not missing(condition) then condition
when missing(condition) and calculated status='Constant' then max(condition) else '' 
end as new_condition
from yourTable
group by icd_grp;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Untested code as no data&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779413#M248216</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779419#M248219</link>
      <description>Hi Reeza,&lt;BR /&gt;Thank you! Question, toward the end of the code is that an open/single quotation " before end as new_condition&lt;BR /&gt;without a closing quotation "?</description>
      <pubDate>Tue, 09 Nov 2021 20:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779419#M248219</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T20:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779420#M248220</link>
      <description>Two single quotes to indicate blank/missing.</description>
      <pubDate>Tue, 09 Nov 2021 20:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779420#M248220</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T20:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779421#M248221</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/346406"&gt;@Clo13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi Reeza,&lt;BR /&gt;Thank you! Question, toward the end of the code is that an open/single quotation " before end as new_condition&lt;BR /&gt;without a closing quotation "?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Check closely. Looks to be two single quotes with nothing between to assign a missing value to a character variable.&lt;/P&gt;
&lt;P&gt;Copy the line of code into any window you can edit and attempt to delete (backspace) the quote. Only one goes away.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 20:54:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779421#M248221</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-09T20:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779425#M248223</link>
      <description>Thank you again. That works but I'm getting one more error with the "group by icd_grp;" statement...and thought perhaps because it's not reading my dataset. How do I point to my dataset in this code? Truly appreciate this - I'm a beginner and need to take more classes. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779425#M248223</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T21:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779428#M248224</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Two single quotes to indicate blank/missing.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since SAS stores character variables as fixed length values padded with blanks it is clearer to include the space between the quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;then max(condition) else ' ' &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779428#M248224</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-09T21:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779432#M248225</link>
      <description>updated my answer.</description>
      <pubDate>Tue, 09 Nov 2021 21:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779432#M248225</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T21:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779433#M248226</link>
      <description>&lt;P&gt;Making progress! Current error message. TY for help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65540iBABD5AFBF696B085/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.png" alt="error.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779433#M248226</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T21:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779435#M248227</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; any thoughts on this error message? Thank you.&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="error.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65541i0361A9CA11038E8E/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.png" alt="error.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:26:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779435#M248227</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T21:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779436#M248228</link>
      <description>There's not enough information shown to help. &lt;BR /&gt;Why are you posting images? Please post the full log and your code/data as text/tables as minimum. &lt;BR /&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779436#M248228</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T21:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779441#M248230</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any chance you can help with this error? So close..&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error2.png" style="width: 857px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65544i613092C4BADCDE58/image-size/large?v=v2&amp;amp;px=999" role="button" title="error2.png" alt="error2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779441#M248230</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T21:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779444#M248233</link>
      <description>calculated cond_status not calculated status.&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779444#M248233</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T21:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to fill in missing values for one variable by group/other var (if all other values are the s</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779468#M248251</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; thank you so much for your help. This worked and if you'd like to edit your code sample I'll post it as accepted solution. Thanks for your patience with images. I'm working within 3 layers of remote desktops but I'll make a habit of transferring files in the future (and using this in the next level of my remote desktop). Truly appreciate your help! I've reduced missing values by 33% by resolving the groups that had constant values. You are amazing!</description>
      <pubDate>Tue, 09 Nov 2021 23:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-fill-in-missing-values-for-one-variable-by-group-other/m-p/779468#M248251</guid>
      <dc:creator>Clo13</dc:creator>
      <dc:date>2021-11-09T23:26:14Z</dc:date>
    </item>
  </channel>
</rss>

