<?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 Macro isdate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25067#M4325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;As a way to improve sql joins with other rdbms I wanted to build a macro that give a datetime value or a column containing datetime values it would output only the year and month.&lt;/P&gt;&lt;P&gt;If I ever pass a hardcoded value of a date then it would return the value using a sysfunc (in order to make our joins faster), if it was a column value or any other expression it would use the put function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro converto_yyyymm(value);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is hardcoded date (either in '31dec2011:00:00:00'dt or 1672531200 formats)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %then %sysfunc(%sysevalf(&amp;amp;value),yymmn6.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else put(&amp;amp;value,yymmn6.);&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I still cound not find a way to make that %if condition, anyone has ideias on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Mar 2012 12:00:48 GMT</pubDate>
    <dc:creator>Pgloria</dc:creator>
    <dc:date>2012-03-08T12:00:48Z</dc:date>
    <item>
      <title>Macro isdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25067#M4325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;As a way to improve sql joins with other rdbms I wanted to build a macro that give a datetime value or a column containing datetime values it would output only the year and month.&lt;/P&gt;&lt;P&gt;If I ever pass a hardcoded value of a date then it would return the value using a sysfunc (in order to make our joins faster), if it was a column value or any other expression it would use the put function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro converto_yyyymm(value);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is hardcoded date (either in '31dec2011:00:00:00'dt or 1672531200 formats)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %then %sysfunc(%sysevalf(&amp;amp;value),yymmn6.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else put(&amp;amp;value,yymmn6.);&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I still cound not find a way to make that %if condition, anyone has ideias on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 12:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25067#M4325</guid>
      <dc:creator>Pgloria</dc:creator>
      <dc:date>2012-03-08T12:00:48Z</dc:date>
    </item>
    <item>
      <title>Macro isdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25068#M4326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; How will the result of your code be used? In a data step? value in line somewhere else?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you provide an example of how the macro is to be called in code and the expected output you'll get better help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 23:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25068#M4326</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2012-03-08T23:20:30Z</dc:date>
    </item>
    <item>
      <title>Macro isdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25069#M4327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is to be used with data integration studio, so it will be in a where clause in a proc sql&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from oracle_table&lt;/P&gt;&lt;P&gt;where month=%converto_yyyymm(&amp;amp;data_macro_var);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from table1, table2&lt;/P&gt;&lt;P&gt;where table1.month_column=%converto_yyyymm(table2.date_column)&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2012 23:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25069#M4327</guid>
      <dc:creator>Pgloria</dc:creator>
      <dc:date>2012-03-08T23:31:10Z</dc:date>
    </item>
    <item>
      <title>Macro isdate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25070#M4328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not understand why you think you need a macro for this.&lt;/P&gt;&lt;P&gt;If you have a value in a macro variable then just use it in the PUT statement the same as you would a variable reference.&lt;/P&gt;&lt;P&gt;Here are some examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put(&amp;amp;value,yymmn6.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Valid values for the macro variable VALUE could be a date literal, an actual date value as the number of days since 1/1/1960, or the name of a variable that has a date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"01JAN2012"d&lt;/P&gt;&lt;P&gt;18993&lt;/P&gt;&lt;P&gt;table2.date_column&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 02:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-isdate/m-p/25070#M4328</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-09T02:09:54Z</dc:date>
    </item>
  </channel>
</rss>

