<?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: If statement error in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242731#M55848</link>
    <description>&lt;P&gt;Since you are referring&amp;nbsp;to an error, it would be nice to see the log.&lt;/P&gt;
&lt;P&gt;First, you need the dates to be stored as SAS dates.&lt;/P&gt;
&lt;P&gt;If you are using macro variable as constants, I think the easiest&amp;nbsp;is to have them formatted as DATE9, so you can use them in the assignment as:&lt;/P&gt;
&lt;PRE&gt;"&amp;amp;service_start_date_dateform."D&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2016 15:55:56 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-01-11T15:55:56Z</dc:date>
    <item>
      <title>If statement error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242720#M55845</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;Please help with the issue here.&amp;nbsp;I have a list of IDs with their eligibility from and thru date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance:&lt;/P&gt;
&lt;P&gt;ID From Thru:&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp;01/01/2012 &amp;nbsp;01/01/2016&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp;&lt;SPAN&gt;01/01/2015&amp;nbsp; 12/31/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp;&lt;SPAN&gt;01/01/2014&amp;nbsp; 07/01/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp;&lt;SPAN&gt;03/01/2012 &amp;nbsp;09/01/2016&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would like my results to look like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ID From Thru:&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp;01/01/2015&amp;nbsp; 12/31/2015&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp;&lt;SPAN&gt;01/01/2015&amp;nbsp; 12/31/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp;&lt;SPAN&gt;01/01/2015 &amp;nbsp;07/01/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp;&lt;SPAN&gt;01/01/2015&amp;nbsp; 12/31/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I used the if statement below and produce blank from and thru results that looks similar to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ID From Thru:&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp;.&amp;nbsp;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp;&lt;SPAN&gt;01/01/2015&amp;nbsp; 12/31/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;3 .&lt;SPAN&gt;&amp;nbsp; 07/01/2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;4 &amp;nbsp;.&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me with this issue? Thank you!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if year(from) &amp;lt; &amp;amp;current_year. then from = &amp;amp;service_start_date_dateform.;
if year(thru) &amp;gt; &amp;amp;current_year. then thru = &amp;amp;service_end_date_dateform.;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242720#M55845</guid>
      <dc:creator>KellyW1117</dc:creator>
      <dc:date>2016-01-11T15:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: If statement error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242730#M55847</link>
      <description>&lt;P&gt;Please show the values of your macro variable &amp;amp;current_year, &amp;amp;service_start_date_dateform and &amp;amp;service_end_date_dateform. Also are your From and Thru variables SAS date values or Character values that look like dates?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242730#M55847</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-11T15:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: If statement error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242731#M55848</link>
      <description>&lt;P&gt;Since you are referring&amp;nbsp;to an error, it would be nice to see the log.&lt;/P&gt;
&lt;P&gt;First, you need the dates to be stored as SAS dates.&lt;/P&gt;
&lt;P&gt;If you are using macro variable as constants, I think the easiest&amp;nbsp;is to have them formatted as DATE9, so you can use them in the assignment as:&lt;/P&gt;
&lt;PRE&gt;"&amp;amp;service_start_date_dateform."D&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:55:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242731#M55848</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-11T15:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: If statement error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242733#M55849</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;The macro is attaced here:&lt;/P&gt;
&lt;P&gt;%let service_start_date_dateform = '01JAN2015';&lt;BR /&gt;%let service_end_date_dateform = '31DEC2015';&lt;/P&gt;
&lt;P&gt;%let current_year = 2015;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both the from and thru are in the date&amp;nbsp;format with length=8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried where statement or "if, else if"; both wont work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242733#M55849</guid>
      <dc:creator>KellyW1117</dc:creator>
      <dc:date>2016-01-11T15:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: If statement error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242735#M55850</link>
      <description>&lt;P&gt;Thank you very much! Adding "d" at the end of the macro works!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 15:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-statement-error/m-p/242735#M55850</guid>
      <dc:creator>KellyW1117</dc:creator>
      <dc:date>2016-01-11T15:58:01Z</dc:date>
    </item>
  </channel>
</rss>

