<?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: Check whether the value of a macro variable is numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317537#M69542</link>
    <description>&lt;P&gt;Try and convert it to a numeric and check if it's not missing&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use INPUT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If input("&amp;amp;macrovariable", ?? Best12.) ne . Then put 'Numeric';&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2016 10:00:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-12-08T10:00:16Z</dc:date>
    <item>
      <title>Datatype macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317531#M69539</link>
      <description>&lt;P&gt;Hi, I need to validate if the value of a macro variable is numeric(float or Integer). Please suggest a way to do this.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 11:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317531#M69539</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-12-08T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317537#M69542</link>
      <description>&lt;P&gt;Try and convert it to a numeric and check if it's not missing&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use INPUT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If input("&amp;amp;macrovariable", ?? Best12.) ne . Then put 'Numeric';&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 10:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317537#M69542</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-08T10:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317547#M69548</link>
      <description>&lt;P&gt;Why use macro variables - which are only text - for numeric data in the first place? &amp;nbsp;Remember Macro Language is only a text generation system, it does nothing on its own, that is what Base SAS is for. &amp;nbsp;There is never a *need* to use macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, if your developing a library tool with paramters, and you need to check it, then maybe something like:&lt;/P&gt;
&lt;PRE&gt;...
data _null_;
  call symput('TEST',ifc(lengthn(compress("&amp;amp;THEVAR."," .","d")) &amp;gt; 0,"Y","N"));
run;

%if "&amp;amp;test."="Y" %then...
  %put Failed;
...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Just to note, in the data _null_, you would do all your parameter checks, and then just output one result.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 10:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317547#M69548</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-08T10:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317554#M69552</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;Negative sign?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 11:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317554#M69552</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-08T11:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317555#M69553</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;: Actually I am validating the parameters passed to a remote macro and need to print the error in log of my local machine</description>
      <pubDate>Thu, 08 Dec 2016 11:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317555#M69553</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-12-08T11:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317557#M69554</link>
      <description>&lt;PRE&gt;

%let x=12.34;
%let f=%datatyp(&amp;amp;x);

%put &amp;amp;x &amp;amp;f;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Dec 2016 11:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317557#M69554</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-12-08T11:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317558#M69555</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;learned my new thing for the day &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p14qy9r4wu1an0n11kfn30idvy20.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p14qy9r4wu1an0n11kfn30idvy20.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 11:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317558#M69555</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-08T11:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Check whether the value of a macro variable is numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317563#M69558</link>
      <description>Thanks a lot. You are a saviour &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;</description>
      <pubDate>Thu, 08 Dec 2016 11:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datatype-macro/m-p/317563#M69558</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-12-08T11:40:38Z</dc:date>
    </item>
  </channel>
</rss>

