<?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 Code almost working in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Code-almost-working/m-p/639601#M9035</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data want;
set have; 
by ID Date Sport; 
keep ID Type Sport Date EventID Defn; 
day = ifc(FIRST.Date, 'Y', 'N'); 
person = ifc(ID, 'Y', 'N'); 
spo = ifc(FIRST.Sport, 'Y', 'N'); 
if Type in (1,2) then do;
dd = intck('MONTH', lag(Date), Date,'C');
if dd=&amp;gt; 6 of FIRST.ID then Defn = 'Y';
else Defn = 'N'
end;
else if Type in (3,4) then do;
if person='Y' and day='Y' and spo='Y' then Defn='Y'
else Defn = 'N';
end;
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;CODE class="  language-sas"&gt;data have; ID Type Sport Date EventID; 12 1 Baseball 06JUN2018 8779 12 1 Baseball 20JUN2019 8452 29 4 Skiing 12JAN2018 5683 29 4 Snowboard 12JAN2018 5683 08 3 Basketball 20MAR2019 1689 58 2 Tennis 30AUG2017 2157&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data above is an example of my data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is almost working how I want it to, but not yet. INTCK is semi-working, and I'm not sure how to completely get it to work (it will say 'Y' for NOV 2011 and 'Y' for JULY 2013, but 'N' for JUNE 2012. Is there a way to fix this? I also want this to return 'Y' for types 3 and 4 if they're 1 day between each other (January 1st and 2nd) and it isn't doing this. How would I fix these?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Apr 2020 23:35:35 GMT</pubDate>
    <dc:creator>mar0000</dc:creator>
    <dc:date>2020-04-13T23:35:35Z</dc:date>
    <item>
      <title>Code almost working</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Code-almost-working/m-p/639601#M9035</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data want;
set have; 
by ID Date Sport; 
keep ID Type Sport Date EventID Defn; 
day = ifc(FIRST.Date, 'Y', 'N'); 
person = ifc(ID, 'Y', 'N'); 
spo = ifc(FIRST.Sport, 'Y', 'N'); 
if Type in (1,2) then do;
dd = intck('MONTH', lag(Date), Date,'C');
if dd=&amp;gt; 6 of FIRST.ID then Defn = 'Y';
else Defn = 'N'
end;
else if Type in (3,4) then do;
if person='Y' and day='Y' and spo='Y' then Defn='Y'
else Defn = 'N';
end;
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;CODE class="  language-sas"&gt;data have; ID Type Sport Date EventID; 12 1 Baseball 06JUN2018 8779 12 1 Baseball 20JUN2019 8452 29 4 Skiing 12JAN2018 5683 29 4 Snowboard 12JAN2018 5683 08 3 Basketball 20MAR2019 1689 58 2 Tennis 30AUG2017 2157&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data above is an example of my data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is almost working how I want it to, but not yet. INTCK is semi-working, and I'm not sure how to completely get it to work (it will say 'Y' for NOV 2011 and 'Y' for JULY 2013, but 'N' for JUNE 2012. Is there a way to fix this? I also want this to return 'Y' for types 3 and 4 if they're 1 day between each other (January 1st and 2nd) and it isn't doing this. How would I fix these?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 23:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Code-almost-working/m-p/639601#M9035</guid>
      <dc:creator>mar0000</dc:creator>
      <dc:date>2020-04-13T23:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Code almost working</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Code-almost-working/m-p/639737#M9036</link>
      <description>&lt;P&gt;In your code is the line&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;person = ifc(ID, 'Y', 'N');&lt;/LI-CODE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;person = ifc(FIRST.ID, 'Y', 'N');&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 13:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Code-almost-working/m-p/639737#M9036</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-04-14T13:05:36Z</dc:date>
    </item>
  </channel>
</rss>

