<?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 Resolving a macro value as a date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolving-a-macro-value-as-a-date/m-p/260965#M310107</link>
    <description>&lt;P&gt;I run a program that gives me different results based on specific parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then use PROC SQL&amp;nbsp;with the INTO clause to create macro variables based on those results. One of the variables created is the numerical date value from a data set. This is, of course, stored as a character variable when the macro vaariable is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then want to create a number of time-series plots with SGPLOT. I'd like to use the value of those date macro variables in the creation of the plots where the extracted date value is resolved in the SGPLOT procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Date=17543

proc sgplot data=uscpi;
      series x=date y=cpi / markers;
      format date yyqc.;
      xaxis values=("&amp;amp;date"d to "1jul10"d by qtr);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a decent way to resolve a macro variable in this fashion?&lt;/P&gt;</description>
    <pubDate>Sun, 03 Apr 2016 23:42:02 GMT</pubDate>
    <dc:creator>KyleM_Corrie</dc:creator>
    <dc:date>2016-04-03T23:42:02Z</dc:date>
    <item>
      <title>Resolving a macro value as a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-a-macro-value-as-a-date/m-p/260965#M310107</link>
      <description>&lt;P&gt;I run a program that gives me different results based on specific parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then use PROC SQL&amp;nbsp;with the INTO clause to create macro variables based on those results. One of the variables created is the numerical date value from a data set. This is, of course, stored as a character variable when the macro vaariable is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I then want to create a number of time-series plots with SGPLOT. I'd like to use the value of those date macro variables in the creation of the plots where the extracted date value is resolved in the SGPLOT procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Date=17543

proc sgplot data=uscpi;
      series x=date y=cpi / markers;
      format date yyqc.;
      xaxis values=("&amp;amp;date"d to "1jul10"d by qtr);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a decent way to resolve a macro variable in this fashion?&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 23:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-a-macro-value-as-a-date/m-p/260965#M310107</guid>
      <dc:creator>KyleM_Corrie</dc:creator>
      <dc:date>2016-04-03T23:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving a macro value as a date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-a-macro-value-as-a-date/m-p/260967#M310108</link>
      <description>&lt;P&gt;If 17543 is the SAS date value you want (number of days since 1/1/1960).&amp;nbsp; Then you could do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date=17543;&lt;BR /&gt;...&lt;BR /&gt;xaxis values=(&amp;amp;date to "1jul10"d by qtr);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You only use the quotes with the d suffix when you want to indicate a date literal.&amp;nbsp; So you could do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date=03Apr2000;&lt;BR /&gt;...&lt;BR /&gt;xaxis values=("&amp;amp;date"d to "1jul10"d by qtr);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2016 00:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-a-macro-value-as-a-date/m-p/260967#M310108</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-04-04T00:02:21Z</dc:date>
    </item>
  </channel>
</rss>

