<?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 Assign a value based on missing and nonmissing rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748296#M235022</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question on how to assign 999 in the column 'desired',&amp;nbsp; if the cell in 'value' column is missing and rows before and after the missing cell has some value (0 or 1 or 2) then we should assign 999 under desired column in that row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;999 must be assigned based on missing values under each ID and section. Please advise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;Sequence&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;section&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;value&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;desired&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;TD class="xl63"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;999&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;5&lt;/TD&gt;
&lt;TD class="xl63"&gt;e&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;TD class="xl63"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;999&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;5&lt;/TD&gt;
&lt;TD class="xl63"&gt;e&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jun 2021 10:45:27 GMT</pubDate>
    <dc:creator>bharath86</dc:creator>
    <dc:date>2021-06-16T10:45:27Z</dc:date>
    <item>
      <title>Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748296#M235022</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question on how to assign 999 in the column 'desired',&amp;nbsp; if the cell in 'value' column is missing and rows before and after the missing cell has some value (0 or 1 or 2) then we should assign 999 under desired column in that row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;999 must be assigned based on missing values under each ID and section. Please advise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;Sequence&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;section&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;value&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;desired&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;TD class="xl63"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;999&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;5&lt;/TD&gt;
&lt;TD class="xl63"&gt;e&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;a&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;b&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;c&lt;/TD&gt;
&lt;TD class="xl63"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;999&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;5&lt;/TD&gt;
&lt;TD class="xl63"&gt;e&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 10:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748296#M235022</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-16T10:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748297#M235023</link>
      <description>&lt;P&gt;What if the value column has another value, say 3 for some ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 10:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748297#M235023</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-06-16T10:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748298#M235024</link>
      <description>&lt;P&gt;There is no chance for another value as it is predefined to have either 0 or 1 or 2 in this case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 10:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748298#M235024</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-16T10:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748299#M235025</link>
      <description>&lt;P&gt;Ok, so that part really doesn't matter or?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you simply want to set desired = 999 if value is missing, correct?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748299#M235025</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-06-16T11:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748300#M235026</link>
      <description>&lt;P&gt;What if the missing value appears as first or last for a given ID?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748300#M235026</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-16T11:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748301#M235027</link>
      <description>&lt;P&gt;I want to assign 999 if the rows before and after the missing rows has any value (0 or 1 or 2).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each ID.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748301#M235027</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-16T11:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748303#M235028</link>
      <description>&lt;P&gt;Then we can ignore them. It is those missing values inbetween the rows with any value (0 or 1 or 2) must be assigned as 999.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If first or last is blank then we should ignore them.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748303#M235028</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-16T11:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748306#M235029</link>
      <description>&lt;P&gt;Run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dsd dlm=" " truncover;
input ID $ Sequence section $ value;
datalines;
1 1 a 0
1 2 b  
1 3 c 1
1 4 d 0
1 5 e 0
2 1 a 1
2 2 b 1
2 3 c  
2 4 d 2
2 5 e 2
3 1 a .
3 2 b 1
4 1 a 0
4 2 b
;

data want;
set have;
by id;
set /* create a "look-ahead" */
  have (
    firstobs=2
    keep=id value
    rename=(id=_id value=_value)
  )
  have ( /* this is needed to prevent a premature end of the data step */
    obs=1
    keep=id value
    rename=(id=_id value=_value)
  )
;
_lvalue = lag(value);
if
  not (first.id or last.id) and
  value = . and _lvalue ne . and _value ne .
then desired = 999;
else desired = value;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note how I create the dataset with a data step with DATALINES; by doing this in the future, you will make it MUCH easier for us to help you, as we will know exactly what we have to deal with.&lt;/P&gt;
&lt;P&gt;I added two groups that illustrate the first/last behavior.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748306#M235029</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-16T11:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748310#M235031</link>
      <description>&lt;P&gt;Same as Kurt's code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dsd dlm=" " truncover;
input ID $ Sequence section $ value;
datalines;
1 1 a 0
1 2 b  
1 3 c 1
1 4 d 0
1 5 e 0
2 1 a 1
2 2 b 1
2 3 c  
2 4 d 2
2 5 e 2
3 1 a .
3 2 b 1
4 1 a 0
4 2 b
;

data want;
 merge have have(firstobs=2 keep=id value rename=(id=_id value=_value));
 desired=value;
 if missing(value) and 
    (id=lag(id) and not missing(lag(value))) and
    (id=_id and not missing(_value)) then desired=999;
drop _: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Jun 2021 11:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748310#M235031</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-16T11:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Assign a value based on missing and nonmissing rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748635#M235123</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see this example. I have inserted 2 additional blank rows under&amp;nbsp; ID=2. This fails when it has 2 or more consequtive blank rows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried modifying firstobs value but it didnt work for second consequtinve blank value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dsd dlm=" " truncover;
input ID $ Sequence section $ value;
datalines;
1 1 a 0
1 2 b  
1 3 c 1
1 4 d 0
1 5 e 0
2 1 a 1
2 2 b 1
2 3 c  
2 4 d 2
2 5 e 2
2 6 f  
2 7 g  
2 8 h 0
3 1 a .
3 2 b 1
4 1 a 0
4 2 b
;
run;



data want;
set have;
by id;
set /* create a "look-ahead" */
  have (
    firstobs=2
    keep=id value
    rename=(id=_id value=_value)
  )
  have ( /* this is needed to prevent a premature end of the data step */
    obs=1
    keep=id value
    rename=(id=_id value=_value)
  )
;
_lvalue = lag(value);
if
  not (first.id or last.id) and
  value = . and _lvalue ne . and _value ne .
then desired = 999;
else desired = value;
drop _:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jun 2021 08:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-a-value-based-on-missing-and-nonmissing-rows/m-p/748635#M235123</guid>
      <dc:creator>bharath86</dc:creator>
      <dc:date>2021-06-17T08:19:57Z</dc:date>
    </item>
  </channel>
</rss>

