<?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 Update value with criteria in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689898#M24699</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data T;
input ID L EXP;
Datalines;
1 1 10
1 2 10
1 2 20
1 3 30
2 1 10
2 1 10
2 2 60
3 2 60
;



data want;
set t;
by id;
if first.id and first.L &amp;gt; 1 then exp=. ;

run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;in this sample I want to update exp to null in case that in every first ID the first L is &amp;gt;1 which is the case with ID = 3&lt;/P&gt;
&lt;P&gt;Where is the mistake in the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 08:45:18 GMT</pubDate>
    <dc:creator>cmemtsa</dc:creator>
    <dc:date>2020-10-08T08:45:18Z</dc:date>
    <item>
      <title>Update value with criteria</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689898#M24699</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data T;
input ID L EXP;
Datalines;
1 1 10
1 2 10
1 2 20
1 3 30
2 1 10
2 1 10
2 2 60
3 2 60
;



data want;
set t;
by id;
if first.id and first.L &amp;gt; 1 then exp=. ;

run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;in this sample I want to update exp to null in case that in every first ID the first L is &amp;gt;1 which is the case with ID = 3&lt;/P&gt;
&lt;P&gt;Where is the mistake in the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 08:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689898#M24699</guid>
      <dc:creator>cmemtsa</dc:creator>
      <dc:date>2020-10-08T08:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Update value with criteria</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689901#M24700</link>
      <description>&lt;P&gt;A first. variable is only created for variables named in the BY statement, and it is boolean, meaning it will only take on the values 0 or 1.&lt;/P&gt;
&lt;P&gt;Corrected code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set t;
by id;
if first.id and L &amp;gt; 1 then exp = .;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2020 08:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689901#M24700</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-08T08:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Update value with criteria</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689902#M24701</link>
      <description>Thanks! That's correct.</description>
      <pubDate>Thu, 08 Oct 2020 08:57:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Update-value-with-criteria/m-p/689902#M24701</guid>
      <dc:creator>cmemtsa</dc:creator>
      <dc:date>2020-10-08T08:57:31Z</dc:date>
    </item>
  </channel>
</rss>

