<?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: By Group processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739743#M230930</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;But what i have realised is that one must "if first.usubjid then flag=flagg;"&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A second variable (&lt;FONT face="courier new,courier"&gt;flagg&lt;/FONT&gt;) &lt;EM&gt;can&lt;/EM&gt; be used, but is not necessary:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
set create;
by usubjid;
retain flag ' ';
if first.usubjid then flag=ifc(aval=0,'Y','N');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2021 11:31:51 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-05-07T11:31:51Z</dc:date>
    <item>
      <title>By Group processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739732#M230926</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help in the following by group processing, such for the same USUBJID, and have AVAL=0 then i need the final output have flag='Y', if that is not the case then populate flag='N'.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="himself_0-1620384528220.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59128i9C2D15C9AC0CFCA3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="himself_0-1620384528220.png" alt="himself_0-1620384528220.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data create;
input usubjid $ aval;
cards;
12 1
12 4
12 0
12 2
13 2
13 5
13 6
13 4
13 0
14 5
14 7
14 8
;
run;

proc sort data=create;
  by usubjid aval;
run;

data check;
  set create;
  by usubjid aval;
	if first.usubjid and aval=0 then flag="Y";
run;



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 May 2021 10:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739732#M230926</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2021-05-07T10:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: By Group processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739735#M230927</link>
      <description>&lt;P&gt;This can be done using a RETAIN statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
    set create;
    by usubjid aval;
    if first.usubjid and aval=0 then flagg="Y"; 
    else flagg="N";
    retain flag;
    if first.usubjid then flag=flagg;
    drop flagg;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 May 2021 10:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739735#M230927</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-07T10:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: By Group processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739740#M230929</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, thanks for the feedback, At some point i thought, the following will work fine,&lt;BR /&gt;data check1;&lt;BR /&gt;    set create;&lt;BR /&gt;    by usubjid aval;&lt;BR /&gt;		retain flag;&lt;BR /&gt;    if first.usubjid and aval=0 then flag="Y"; &lt;BR /&gt;    else flag="N";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;But what i have realised is that one must "if first.usubjid then flag=flagg;"</description>
      <pubDate>Fri, 07 May 2021 11:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739740#M230929</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2021-05-07T11:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: By Group processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739743#M230930</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310015"&gt;@himself&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;But what i have realised is that one must "if first.usubjid then flag=flagg;"&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A second variable (&lt;FONT face="courier new,courier"&gt;flagg&lt;/FONT&gt;) &lt;EM&gt;can&lt;/EM&gt; be used, but is not necessary:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
set create;
by usubjid;
retain flag ' ';
if first.usubjid then flag=ifc(aval=0,'Y','N');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 11:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-processing/m-p/739743#M230930</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-05-07T11:31:51Z</dc:date>
    </item>
  </channel>
</rss>

