<?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: Convert date to a literal in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519908#M140913</link>
    <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;proc sql;  
  create table work.inventory as
  select cust_nbr, 
         annual_income
  from   customer_&amp;amp;yyyymmdd_d1
  where  source_date eq input("&amp;amp;yyyymmdd_d1.",yymmdd8.);
quit;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Dec 2018 11:51:16 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-12-10T11:51:16Z</dc:date>
    <item>
      <title>Convert date to a literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519905#M140910</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a macro variable which has the date in a below format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let yyyymmdd_d1 = 20181201;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use this in a condition where my dataset has a source_date value as number 8&amp;nbsp; and format yymmdd10. please help for this scenario.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the below code, this will work if i hardcode the dates. But if i want to use this macro variable, it will not accept since the source_date value in the customer dataset is in num8 and with format yymmdd10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table work.inventory as&lt;/P&gt;&lt;P&gt;select cust_nbr, annual_income&lt;BR /&gt;from customer_&amp;amp;&lt;SPAN&gt;yyyymmdd_d1&lt;/SPAN&gt;&lt;BR /&gt;where source_date eq "01Dec2018"d;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 11:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519905#M140910</guid>
      <dc:creator>Jagadeesh2907</dc:creator>
      <dc:date>2018-12-10T11:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to a literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519908#M140913</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;proc sql;  
  create table work.inventory as
  select cust_nbr, 
         annual_income
  from   customer_&amp;amp;yyyymmdd_d1
  where  source_date eq input("&amp;amp;yyyymmdd_d1.",yymmdd8.);
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Dec 2018 11:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519908#M140913</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-10T11:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to a literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519911#M140915</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the solution. Can you tell me what is the variable type of a macro ? will it be treated as character or will be based on the value of the macro variable ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519911#M140915</guid>
      <dc:creator>Jagadeesh2907</dc:creator>
      <dc:date>2018-12-10T12:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert date to a literal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519929#M140926</link>
      <description>&lt;P&gt;Macro varibles are&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;always&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;text.&amp;nbsp; They cannot be anything else.&amp;nbsp; Macro is a find/replace text generator which happens before code compilation.&amp;nbsp; This is why we always recommend to use Base SAS - this is the programming language with all the data types, functions etc. and that which gets compiled, rather than using macro which is nothing more than a find/replace system.&amp;nbsp; Macro has its place, but that place is not to replace Base SAS coding.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 12:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-date-to-a-literal/m-p/519929#M140926</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-10T12:32:54Z</dc:date>
    </item>
  </channel>
</rss>

