<?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 Assign date9. to macro var in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47870#M9898</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let dsin = test;&lt;/P&gt;&lt;P&gt;%let rc = %sysfunc(open(&amp;amp;dsin, I));&lt;/P&gt;&lt;P&gt;%if &amp;amp;rc % then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let cdate = %sysfunc(attrn(&amp;amp;rc, crdte));&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question is: How to get cdate in date9. format? This can be done using data null and call symput but I would like to know if can be done in above method?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2011 22:14:47 GMT</pubDate>
    <dc:creator>Dwight09</dc:creator>
    <dc:date>2011-11-15T22:14:47Z</dc:date>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47870#M9898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let dsin = test;&lt;/P&gt;&lt;P&gt;%let rc = %sysfunc(open(&amp;amp;dsin, I));&lt;/P&gt;&lt;P&gt;%if &amp;amp;rc % then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let cdate = %sysfunc(attrn(&amp;amp;rc, crdte));&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question is: How to get cdate in date9. format? This can be done using data null and call symput but I would like to know if can be done in above method?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 22:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47870#M9898</guid>
      <dc:creator>Dwight09</dc:creator>
      <dc:date>2011-11-15T22:14:47Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47871#M9899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; What result are you currently getting for CDATE? That is likely to be OS dependent so we need to see what you have.&lt;/P&gt;&lt;P&gt;The likely solution will involve some form of %sysfunc(inputn or inputc depending, with a date informat. That would be inside a %sysfunc(putn({long expression},date9.)0;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 22:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47871#M9899</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-11-15T22:49:19Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47872#M9900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; assuming internal value of &amp;amp;crdte is a sas date (#days since 1/1/1960)&lt;/P&gt;&lt;P&gt;%let date_constant = %sysfunc( putn( &amp;amp;crdte, date11 )) ;&lt;/P&gt;&lt;P&gt;* date11 looks even better than date9, and works just as well in:&lt;/P&gt;&lt;P&gt;&amp;nbsp; where date_var &amp;lt;= "&amp;amp;date_constant"d&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 23:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47872#M9900</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-11-15T23:16:33Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47873#M9901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;crdate value is &lt;SPAN style="font-size: 8pt;"&gt;1636523977. Tried %sysfunc(putn(&amp;amp;crdate, date9.)) but not working. I get &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;********* [all asteriks]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 23:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47873#M9901</guid>
      <dc:creator>Dwight09</dc:creator>
      <dc:date>2011-11-15T23:43:41Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47874#M9902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; You can do it with nested functions. sysfunc has a put by default so you don't need a putn either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However your variable is actually a datetime variable not a date variable so you need to take the datepart of the datetime variable first, then do the format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let cdate=%sysfunc(datepart(%sysfunc(attrn(&amp;amp;rc, crdte))),date9.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2011 01:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47874#M9902</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-11-16T01:09:45Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47875#M9903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; at some point SAS formats were extended with a few prefixed DT - these are designed for datetime values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When extracting just the date part of "created date", we don't need the datepart() function, just DTDATE9&lt;/P&gt;&lt;P&gt;%let cdate= %sysfunc(attrn(&amp;amp;rc, crdte),DTdate9 );&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2011 10:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47875#M9903</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-11-16T10:52:04Z</dc:date>
    </item>
    <item>
      <title>Assign date9. to macro var</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47876#M9904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; When I tried a DATETIME16. format with that value of &lt;SPAN style="font-size: 8pt;"&gt;1636523977 for&lt;/SPAN&gt; cdate I get &lt;SPAN style="font-size: 8pt;"&gt;10NOV11:05:59:37. Does that look like the correct date for your example? If so you want the DATEPART of CDATE.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2011 19:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-date9-to-macro-var/m-p/47876#M9904</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-11-16T19:10:16Z</dc:date>
    </item>
  </channel>
</rss>

