<?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 Have I reached a date9. macro variable with this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696908#M212954</link>
    <description>&lt;P&gt;%let dt = Today();&lt;BR /&gt;DATA _NULL_;&lt;/P&gt;
&lt;P&gt;DCS3YR= put(Intnx('YEAR',&amp;amp;dt,-3,'S'),date9.);&lt;BR /&gt;call SYMPUTX('DCS3YR', DCS3YR);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;DCS3YR;&lt;BR /&gt;%let DCS3YR_d9 =%sysfunc(inputn(&amp;amp;dcs3yr,date9.),date9.);&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;DCS3YR_d9;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2020 15:36:19 GMT</pubDate>
    <dc:creator>Kiteulf</dc:creator>
    <dc:date>2020-11-05T15:36:19Z</dc:date>
    <item>
      <title>Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696908#M212954</link>
      <description>&lt;P&gt;%let dt = Today();&lt;BR /&gt;DATA _NULL_;&lt;/P&gt;
&lt;P&gt;DCS3YR= put(Intnx('YEAR',&amp;amp;dt,-3,'S'),date9.);&lt;BR /&gt;call SYMPUTX('DCS3YR', DCS3YR);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;DCS3YR;&lt;BR /&gt;%let DCS3YR_d9 =%sysfunc(inputn(&amp;amp;dcs3yr,date9.),date9.);&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;DCS3YR_d9;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 15:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696908#M212954</guid>
      <dc:creator>Kiteulf</dc:creator>
      <dc:date>2020-11-05T15:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696912#M212956</link>
      <description>&lt;P&gt;Did you mean:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let DCS3YR_d9 =%sysfunc(put(inputn(&amp;amp;dcs3yr,date9.)),date9.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Code was not tested.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 15:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696912#M212956</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-11-05T15:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696913#M212957</link>
      <description>&lt;P&gt;I would say it depends on what you mean by "reached a date. macro variable". Or what you expect for result. You don't say what you want or expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have created text in the date9 appearance. With points for a complicated way of duplicating:&lt;/P&gt;
&lt;P&gt;%let DCS3YR_d9= &amp;amp;DCS3YR ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you expect to manipulate "dates" using macro language it much better NOT to format the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 15:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696913#M212957</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-05T15:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696918#M212959</link>
      <description>&lt;P&gt;Whenever you need a date value for calculations or comparisons, it is much better to not format the macro variable in any way. See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cutoff = %sysfunc(intnx(year,%sysfunc(today()),-3,s));

data want;
set have;
where date &amp;gt; &amp;amp;cutoff.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Formatted values in macro variables are only needed if you use the macro variable for display, e.g. in a TITLE statement.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 16:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696918#M212959</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-05T16:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696929#M212962</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Formatted values in macro variables are only needed if you use the macro variable for display, e.g. in a TITLE statement.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or to match an external file name for input/output rules.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 16:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696929#M212962</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-05T16:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Have I reached a date9. macro variable with this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696938#M212965</link>
      <description>&lt;P&gt;Macro variables are just strings.&amp;nbsp; You have made two macro variables with the same 9 characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a macro variable with a value that the DATE informat understands then you can use as a date literal in your code by adding quotes and the letter d.&amp;nbsp; So here is another convoluted way to make a copy of your DCS3YR macro variable.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let copy2 = %sysfunc(putn("&amp;amp;dcs3yr"d,date9.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 17:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Have-I-reached-a-date9-macro-variable-with-this/m-p/696938#M212965</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-05T17:25:52Z</dc:date>
    </item>
  </channel>
</rss>

