<?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: macro error using inputn in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199005#M37278</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or use a proper date literal such as '01AUG3013'd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Mar 2015 15:01:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-03-11T15:01:28Z</dc:date>
    <item>
      <title>macro error using inputn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199002#M37275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let date1='08/01/2013'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET xDate = inputn(%sysfunc(compress(&amp;amp;date1,"")),"yyyymm.");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, xDate never gets the changed date format (yyyymm) based on the above.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 13:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199002#M37275</guid>
      <dc:creator>sasboy007</dc:creator>
      <dc:date>2015-03-11T13:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: macro error using inputn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199003#M37276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all, your code has a syntax error (missing the semicolon after the %let)&lt;/P&gt;&lt;P&gt;Second, inputn is a data step function that will not work on its own in a macro statement.&lt;/P&gt;&lt;P&gt;Third, yyyymm is not a valid SAS format, but yymm is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to make it simple, use a data step:&lt;/P&gt;&lt;P&gt;%let date1=08/01/2013;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;datenew = put(input("&amp;amp;date1",mmddyy8.),yymm.);&lt;/P&gt;&lt;P&gt;call symput("xdate",datenew);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put "&amp;amp;xdate";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 13:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199003#M37276</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-03-11T13:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: macro error using inputn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199004#M37277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to add to that, why not keep the date in a parameter dataset and use it from there, e.g. joining it on.&amp;nbsp; It avoids that whole nasty macro variable processing of converting string to date and back again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 13:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199004#M37277</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-11T13:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: macro error using inputn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199005#M37278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or use a proper date literal such as '01AUG3013'd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:01:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199005#M37278</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-11T15:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: macro error using inputn</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199006#M37279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that your real error is not specifying a length on your INFORMAT.&amp;nbsp; You also have messed up values because of extra quotes. Macro variables are always text strings, so unless you want to include the quotes in the value do not use quotes.&amp;nbsp; This also applies to character arguments for function calls.&lt;/P&gt;&lt;P&gt;Note that you can also add a format to the %SYSFUNC() call to specify how you want SAS to convert the answer of the INPUTN() function call, which will be a number, to the string that you are assigning to your macro variable.&lt;/P&gt;&lt;P&gt;Here is an example with a few different output formats.&lt;/P&gt;&lt;P&gt;XDATE1 or XDATE4 could be used in SAS code to reference the date.&lt;/P&gt;&lt;P&gt;XDATE2 or XDATE3 could be used as strings to use in TITLE or other place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; date1=8/1/2013;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xDate1 = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(inputn(&amp;amp;date1,mmddyy10));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xDate2 = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(inputn(&amp;amp;date1,mmddyy10),mmddyy10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xDate3 = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(inputn(&amp;amp;date1,mmddyy10),date9);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; xDate4 = "&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(inputn(&amp;amp;date1,mmddyy10),date9)"d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;=date1 &amp;amp;=xDate1 &amp;amp;=xDate2 &amp;amp;=xDate3 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Courier New';"&gt;DATE1=8/1/2013 XDATE1=19571 XDATE2=08/01/2013 XDATE3=01AUG2013 &lt;SPAN style="font-family: 'Courier New'; font-size: 16px;"&gt;XDATE3="01AUG2013"d&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 15:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-error-using-inputn/m-p/199006#M37279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-11T15:20:03Z</dc:date>
    </item>
  </channel>
</rss>

