<?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: numeric to char in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224556#M40344</link>
    <description>&lt;P&gt;Your code is using a DATA step function to write to a macro variable then trying to write the macro variable back to a SAS variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not just do it directly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cur =&amp;nbsp;&lt;SPAN&gt;put(intnx('MONTH',today(),0,'b'),&lt;/SPAN&gt;&lt;SPAN&gt;yymmn6.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2015 02:24:21 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2015-09-09T02:24:21Z</dc:date>
    <item>
      <title>numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224553#M40342</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've below macro that is creating 201509 value as numeric. I need it as a character value. Please suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;call symput('currmon',put(intnx('MONTH',today(),0,'b'),yymmn6.));&lt;/P&gt;&lt;P&gt;cur=&amp;amp;currmon.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 01:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224553#M40342</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2015-09-09T01:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224555#M40343</link>
      <description>In the same data step ?&lt;BR /&gt;&lt;BR /&gt;cur=symgetn('currmon') ;</description>
      <pubDate>Wed, 09 Sep 2015 02:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224555#M40343</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-09-09T02:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224556#M40344</link>
      <description>&lt;P&gt;Your code is using a DATA step function to write to a macro variable then trying to write the macro variable back to a SAS variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not just do it directly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cur =&amp;nbsp;&lt;SPAN&gt;put(intnx('MONTH',today(),0,'b'),&lt;/SPAN&gt;&lt;SPAN&gt;yymmn6.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 02:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224556#M40344</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-09-09T02:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224573#M40348</link>
      <description>&lt;P&gt;Only add the double quotes to your string&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;call symput('currmon',put(intnx('MONTH',today(),0,'b'),yymmn6.));&lt;/P&gt;&lt;P&gt;cur="&amp;amp;currmon.";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 06:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224573#M40348</guid>
      <dc:creator>surajdvpatil</dc:creator>
      <dc:date>2015-09-09T06:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224574#M40349</link>
      <description>&lt;P&gt;No Need to use intnx function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data x;&lt;BR /&gt;call symput('currmon',put(today(),yymmn6.));&lt;BR /&gt;cur="&amp;amp;currmon.";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 06:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224574#M40349</guid>
      <dc:creator>surajdvpatil</dc:creator>
      <dc:date>2015-09-09T06:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224580#M40350</link>
      <description>&lt;P&gt;Both of your tips won't work because the macro variable in the cur= assigment will be evaluated (during data step compilation) before it is set with the call symput (during data step execution)&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 07:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224580#M40350</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-09-09T07:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224678#M40355</link>
      <description>&lt;P&gt;My bad guys, Thanks for your response. I'm not trying to write the value back to variable. I just did that to see if the macro variable is resolving as a numeric or character.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 11:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224678#M40355</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2015-09-09T11:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224699#M40357</link>
      <description>&lt;P&gt;I tried doing the same and it still gives me a numeric value of 201509.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 11:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224699#M40357</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2015-09-09T11:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: numeric to char</title>
      <link>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224789#M40370</link>
      <description>&lt;P&gt;All macro variables are stored as strings. &amp;nbsp;What behavour (error message etc) are you seeing that makes it numeric.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a002293823.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a002293823.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see from this log that if we try to store a numeric in a macro var it is converted to char by SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1 data null;
2 call symput('currmonS',put(date(),yymmn6.));
3 call symput('currmonN',date());
4 run;
NOTE: Numeric values have been converted to character values at the places given by:
(Line) : (Column).
3:28&lt;/PRE&gt;
&lt;P&gt;NOTE: The data set WORK.NULL has 1 observations and 0 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.01 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 17:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/numeric-to-char/m-p/224789#M40370</guid>
      <dc:creator>ChrisWard</dc:creator>
      <dc:date>2015-09-09T17:07:16Z</dc:date>
    </item>
  </channel>
</rss>

