<?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 end of month with conditional clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803132#M316237</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data flag;
input custormerid 1-3 st_date $5-14  enddate $ 16-26;
format st_date DDMMYYS10. enddate DDMMYYS10.;
datalines;
001 01/01/2016	30/01/2016
002 02/02/2016	25/02/2016
003	05/03/2016	31/03/2016
004	06/04/2016	17/04/2016
005	08/05/2016	31/05/2016
006	09/06/2016	08/06/2016
007	11/07/2016	04/07/2016
008	12/08/2016	30/07/2016
009	13/09/2016	31/08/2016
010	15/10/2016	30/09/2016
;
run;


data endmonth;
set  flag;
if enddate=intnx('month',enddate,0,'e') then flag='Yes';
else  flag= 'No';
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want flag variable which date is end of month Yes&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which is not end of month NO&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2022 16:06:24 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2022-03-21T16:06:24Z</dc:date>
    <item>
      <title>end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803132#M316237</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data flag;
input custormerid 1-3 st_date $5-14  enddate $ 16-26;
format st_date DDMMYYS10. enddate DDMMYYS10.;
datalines;
001 01/01/2016	30/01/2016
002 02/02/2016	25/02/2016
003	05/03/2016	31/03/2016
004	06/04/2016	17/04/2016
005	08/05/2016	31/05/2016
006	09/06/2016	08/06/2016
007	11/07/2016	04/07/2016
008	12/08/2016	30/07/2016
009	13/09/2016	31/08/2016
010	15/10/2016	30/09/2016
;
run;


data endmonth;
set  flag;
if enddate=intnx('month',enddate,0,'e') then flag='Yes';
else  flag= 'No';
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want flag variable which date is end of month Yes&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which is not end of month NO&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803132#M316237</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-03-21T16:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803137#M316238</link>
      <description>&lt;P&gt;To use the INTNX() function and the DDMMYYS format with your variables you need to populate them with date values and not text strings.&lt;/P&gt;
&lt;P&gt;So when reading the values from the source text using the DDMMYY informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input custormerid st_date :ddmmyy. enddate :ddmmyy. ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use the INPUT() function in your testing for the end of the month.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if input(enddate,ddmmyy10.)=intnx('month',input(enddate,ddmmyy10.),0,'e') then flag='Yes';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803137#M316238</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-21T16:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803139#M316239</link>
      <description>&lt;P&gt;In addition to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;said, save yourself some typing and prevent some potential typographical errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use numeric 1 instead of 'Yes'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use numeric 0 instead of 'No'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If necessary for clarity, you can assign a custom format to this 0/1 variable. In addition, the arithmetic mean of the 0/1 variable is the proportion of 1s.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803139#M316239</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-21T16:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803144#M316242</link>
      <description>&lt;P&gt;Thank you paigemiller&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803144#M316242</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-03-21T16:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803145#M316243</link>
      <description>&lt;P&gt;why we use input function&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803145#M316243</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-03-21T16:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: end of month with conditional clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803150#M316247</link>
      <description>&lt;P&gt;Use the INPUT statement if you are actually reading the data from text, like in your little example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you already have a SAS dataset that has the date as a &lt;STRONG&gt;character&lt;/STRONG&gt; variable then you need the INPUT() function call to convert those strings into actual date values.&amp;nbsp; Or make a new version of the dataset that uses the INPUT() function to create a variable that has actual date values.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 16:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/end-of-month-with-conditional-clause/m-p/803150#M316247</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-21T16:47:50Z</dc:date>
    </item>
  </channel>
</rss>

