<?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: Modify output occurring in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266596#M52578</link>
    <description>&lt;P&gt;Overwrite it at the end of code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 if _n_ eq 1 then do;
  declare hash hh();
  hh.definekey('id');
  hh.definedata('count');
  hh.definedone();
  declare hash h();
  h.definekey('id','email_address');
  h.definedone();
 end;
 set have;
 length flag $ 8; 
 if h.find()=0 then do;
   hh.find();flag='NO';
 end;
 else do;
  flag='YES';
  if hh.find()=0 then count+1;
   else count=1;
 h.replace();hh.replace();
 end;


if count=1 then flag=' ';

run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Apr 2016 01:51:13 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-04-27T01:51:13Z</dc:date>
    <item>
      <title>Modify output occurring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266571#M52567</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm modifying this code to attempt to obtain the following output.&amp;nbsp;Basically I have a first_time_email_seen_with_user field below, and I want to to return a blank for this value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID Date email_address&lt;/P&gt;&lt;P&gt;josh 1/1/2015 josh1@gmail.com&lt;BR /&gt;josh 1/2/2015 josh2@yahoo.com&lt;BR /&gt;josh 1/3/2015 josh3@yahoo.com&lt;BR /&gt;mary 1/4/2015 mary123@aol.com&lt;BR /&gt;mary 1/5/2015 mars@blah.com&lt;BR /&gt;josh 1/6/2015 josh1@gmail.com&lt;BR /&gt;josh 1/7/2015 josh2@yahoo.com&lt;BR /&gt;josh 1/8/2015 josh3@yahoo.com&lt;BR /&gt;mary 1/9/2015 mary123@aol.com&lt;BR /&gt;mary 1/10/2015 mars@blah.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID Date email_address distinct_emails_for_user&amp;nbsp;first_time_email_seen_with_user&lt;/P&gt;&lt;P&gt;josh 1/1/2015 josh1@gmail.com 1 .&lt;BR /&gt;josh 1/2/2015 josh2@yahoo.com 2 YES&lt;BR /&gt;josh 1/3/2015 josh3@yahoo.com 3 YES&lt;BR /&gt;mary 1/4/2015 mary123@aol.com 1 .&lt;BR /&gt;mary 1/5/2015 mars@blah.com 2 YES&lt;BR /&gt;josh 1/6/2015 josh1@gmail.com 3 NO&lt;BR /&gt;josh 1/7/2015 josh2@yahoo.com 3 NO&lt;BR /&gt;josh 1/8/2015 josh3@yahoo.com 3 NO&lt;BR /&gt;mary 1/9/2015 mary123@aol.com 2 NO&lt;BR /&gt;mary 1/10/2015 mars@blah.com 2 NO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far ksharp has assisted me with this portion of the code. I know that there's something that we have to add with first.id -- that will allow me to modify the first instance of the record occuring, but I'm unsure of how where to implement this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 if _n_ eq 1 then do;
  declare hash hh();
  hh.definekey('id');
  hh.definedata('count');
  hh.definedone();
  declare hash h();
  h.definekey('id','email_address');
  h.definedone();
 end;
 set have;
 length flag $ 8; 
 if h.find()=0 then do;
   hh.find();flag='NO';
 end;
 else do;
  flag='YES';
  if hh.find()=0 then count+1;
   else count=1;
 h.replace();hh.replace();
 end;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 22:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266571#M52567</guid>
      <dc:creator>JS</dc:creator>
      <dc:date>2016-04-26T22:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Modify output occurring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266592#M52574</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want4 (drop=flag);
set want2;
/*by id;*/
first_time_appear=flag;
if first.id then first_app_in_acct =1;
run;
proc print;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added an extra field at the end that created a seperate flag for the first record by account. I simply use that to exclude those values when I am tabulating the query.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 01:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266592#M52574</guid>
      <dc:creator>JS</dc:creator>
      <dc:date>2016-04-27T01:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Modify output occurring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266596#M52578</link>
      <description>&lt;P&gt;Overwrite it at the end of code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 if _n_ eq 1 then do;
  declare hash hh();
  hh.definekey('id');
  hh.definedata('count');
  hh.definedone();
  declare hash h();
  h.definekey('id','email_address');
  h.definedone();
 end;
 set have;
 length flag $ 8; 
 if h.find()=0 then do;
   hh.find();flag='NO';
 end;
 else do;
  flag='YES';
  if hh.find()=0 then count+1;
   else count=1;
 h.replace();hh.replace();
 end;


if count=1 then flag=' ';

run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2016 01:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-output-occurring/m-p/266596#M52578</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-27T01:51:13Z</dc:date>
    </item>
  </channel>
</rss>

