<?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: Imputation technique in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745852#M36332</link>
    <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
set comm_q;
by id visit section;
retain three_zero counter;
if first.section
then do;
  three_zero = 0;
  counter = 0;
end;
if value = 0
then do;
  counter + 1;
  if counter ge 3 then three_zero = 1;
end;
else counter = 0;
if value = .
then do;
  if three_zero then desired = 0;
end;
else do;
  desired = value;
  if value ne 0
  then do;
    three_zero = 0;
    counter = 0;
  end;
end;
drop counter three_zero;
run;

proc sort data=want1;
by id visit section descending section_id;
run;

data want2;
set want1;
by id visit section;
retain had_two;
if first.section then had_two = 0;
if value = 2 then had_two = 1;
if value = .
then do;
  if had_two and desired = . then desired = 2;
end;
else if value ne 2 then had_two = 0;
drop had_two;
run;

proc sort data=want2;
by id visit section section_id;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 04 Jun 2021 16:47:30 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-06-04T16:47:30Z</dc:date>
    <item>
      <title>Imputation technique</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745728#M36328</link>
      <description>&lt;P&gt;Hi PFA attached sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to impute some values (name of output variable 'desired_Imp_val') based on input variable&amp;nbsp; 'Value' .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to derive two imputations as below. Please advise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.Within a section, If a ID mastered an item and received score of 2 and all items prior to this item have no scores, all prior scores will be imputed as 2 for this visit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If a ID had 3 consecutive 0 scores in a visit and no values for higher number items in this section for this visit, the higher number items will be imputed with score of 0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Above imputations must be visit and section specific.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 11:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745728#M36328</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-04T11:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Imputation technique</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745744#M36329</link>
      <description>&lt;P&gt;Post usable example data, as shown here&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Statistical-Procedures/Assign-value-from-any-row-by-ID/m-p/704640/highlight/true#M34092" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/Statistical-Procedures/Assign-value-from-any-row-by-ID/m-p/704640/highlight/true#M34092&lt;/A&gt;&amp;nbsp;in an answer to one of your previous questions. Excel files are mostly useless for representing SAS datasets, and many of us can't even download them to our SAS environments because our corporate firewalls block them for security reasons.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 11:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745744#M36329</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-04T11:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Imputation technique</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745828#M36331</link>
      <description>&lt;P&gt;I have uploaded the data as a sas dataset. Please let me know if this helps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:06:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745828#M36331</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-04T16:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Imputation technique</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745852#M36332</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
set comm_q;
by id visit section;
retain three_zero counter;
if first.section
then do;
  three_zero = 0;
  counter = 0;
end;
if value = 0
then do;
  counter + 1;
  if counter ge 3 then three_zero = 1;
end;
else counter = 0;
if value = .
then do;
  if three_zero then desired = 0;
end;
else do;
  desired = value;
  if value ne 0
  then do;
    three_zero = 0;
    counter = 0;
  end;
end;
drop counter three_zero;
run;

proc sort data=want1;
by id visit section descending section_id;
run;

data want2;
set want1;
by id visit section;
retain had_two;
if first.section then had_two = 0;
if value = 2 then had_two = 1;
if value = .
then do;
  if had_two and desired = . then desired = 2;
end;
else if value ne 2 then had_two = 0;
drop had_two;
run;

proc sort data=want2;
by id visit section section_id;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745852#M36332</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-04T16:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Imputation technique</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745853#M36333</link>
      <description>Thank you very much.</description>
      <pubDate>Fri, 04 Jun 2021 16:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Imputation-technique/m-p/745853#M36333</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-04T16:56:26Z</dc:date>
    </item>
  </channel>
</rss>

