<?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 to convert character to numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108802#M22619</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to work , but is there an easy way I could use use all variables in one macro statement instead of calling the macro 167 times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 May 2012 14:02:45 GMT</pubDate>
    <dc:creator>saslove</dc:creator>
    <dc:date>2012-05-09T14:02:45Z</dc:date>
    <item>
      <title>Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108796#M22613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have this macro to convert character to numeric variable for more than 100 variables. But it doesn't seem to work and gives me an error:&amp;nbsp;&amp;nbsp; 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is as below:&lt;/P&gt;&lt;P&gt;%macro numeric (var);&lt;/P&gt;&lt;P&gt;data recode2005_7;&lt;/P&gt;&lt;P&gt;set recode2005_6;&lt;/P&gt;&lt;P&gt;&amp;amp;var _c=input(&amp;amp;var ,8.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend numeric;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%numeric (age sex grade am_indi... var 100);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SAS log highlights age and pops the above error. Not sure what it is. Tried putting var= on macro statement and other alternatives, but doesn't work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 01:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108796#M22613</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2012-05-09T01:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108797#M22614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you need to change&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit; font-size: 13px; font-style: inherit;"&gt;&lt;STRONG&gt;&amp;amp;var_c&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;=input(&amp;amp;var ,8.);&amp;nbsp;&amp;nbsp; to &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit; font-size: 13px; font-style: inherit;"&gt;&lt;STRONG&gt;var_c&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;=input(&amp;amp;var ,8.);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro numeric (var);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data recode2005_7;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set recode2005_6;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;var_c&lt;/STRONG&gt;&lt;/SPAN&gt;=input(&amp;amp;var ,8.);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend numeric;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 01:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108797#M22614</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-05-09T01:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108798#M22615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code is bad. About your macro, there is only one macro variable parameter.&lt;/P&gt;&lt;P&gt;From the content of code, it only can process one variable each time. So invoke the macro each time for each variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro numeric (var);&lt;/P&gt;&lt;P&gt;data recode2005_7;&lt;/P&gt;&lt;P&gt;set recode2005_6;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;var_c&lt;/STRONG&gt;=input(&amp;amp;var ,8.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend numeric;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%numeric (age )&lt;/P&gt;&lt;P&gt;%numeric (var1)&lt;/P&gt;&lt;P&gt;%numeric (var2)&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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 07:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108798#M22615</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-09T07:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108799#M22616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And I believe if you intended to name the character variable based on the paramter that you pass you'll need a period before the "_c" in the name (slight modification to Ksharp's code)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro numeric (var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data recode2005_7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set recode2005_6;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;var._c&lt;/STRONG&gt;=input(&amp;amp;var ,8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 13:53:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108799#M22616</guid>
      <dc:creator>JasonDiVirgilio</dc:creator>
      <dc:date>2012-05-09T13:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108800#M22617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for your replies. It still doesn't seem to work. I tried all of these options. It gives me the same error&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 13:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108800#M22617</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2012-05-09T13:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108801#M22618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A few comments ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works for a single variable.&amp;nbsp; If you have a list of variables you want to convert using the same logic, you still have a lot of work to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code would be a lot more useful if you would leave the DATA and SET statements out of the macro definition.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 13:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108801#M22618</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-09T13:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108802#M22619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to work , but is there an easy way I could use use all variables in one macro statement instead of calling the macro 167 times?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 14:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108802#M22619</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2012-05-09T14:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108803#M22620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why I keep posting the wrong code? hope this one is the one I intented to post.:smileysilly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can modify the code below to convert your character variables to numeric variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;length date1 date2 $10;&lt;BR /&gt;&amp;nbsp; input age weight (id sex a b c d e)($)&amp;nbsp; date1 date2; &lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;100 150 1 2 11 22 33 44 55&amp;nbsp; 01/12/2012 2/12/2012&lt;BR /&gt;;&lt;BR /&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select catx(' ','input(',name,',best32.) as',name) into : list1 separated by ','&lt;BR /&gt;&amp;nbsp; from dictionary.columns&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE' and type ='char' and name not in ('id','sex','date1','date2');&lt;/P&gt;&lt;P&gt;/* &amp;amp;list1 includes all the character variables you want to convert to numeric. In the example, id,sex,date1,date2 were excluded. */&lt;/P&gt;&lt;P&gt;select name into : list2 separated by ','&amp;nbsp; from dictionary.columns&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE' and type ='num' ;&lt;/P&gt;&lt;P&gt;/* &amp;amp;list2 includes all the numeric variables */&lt;/P&gt;&lt;P&gt;select catx(' ','input(',name,',mmddyy10.)&amp;nbsp; format=mmddyy10. as',name)&amp;nbsp; into : list3 separated by ','&amp;nbsp; from dictionary.columns&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where libname='WORK' and memname='HAVE' and name in ('date1','date2');&lt;/P&gt;&lt;P&gt;/* &amp;amp;list3 includes all the date variables */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table want as&lt;BR /&gt;&amp;nbsp; select id,sex,&amp;amp;list1,&amp;amp;list2,&amp;amp;list3 from have;&lt;/P&gt;&lt;P&gt;quit;&lt;BR /&gt;proc contents data=want;run;proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 14:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108803#M22620</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-05-09T14:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108804#M22621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Linlin's code raises an interesting point.&amp;nbsp; Perhaps it would be easier (and less prone to error) to specify a list of character variables that should NOT be converted, rather than a list of those that should be converted.&amp;nbsp; At any rate, here's an approach that continues along the lines of what you have seen so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro convert (varlist);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %local i nextvar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %do i = 1 %to %sysfunc(countw(&amp;amp;varlist));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let nextvar = %scan(&amp;amp;varlist, &amp;amp;i, %str( ));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;nextvar._c = input(&amp;amp;nextvar, 8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;%mend convert;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %convert (age sex grade)&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is to loop through the list of variable names, and for each one generate a statement to convert it to numeric.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, I followed your lead in naming the new variables with "_c".&amp;nbsp; It might be less confusing to name them using "_n" since these are the numeric versions not the character versions.&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 14:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108804#M22621</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-09T14:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108805#M22622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input (age sex grade) ($);&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;2 4 8&lt;/P&gt;&lt;P&gt;6 6 10&lt;/P&gt;&lt;P&gt;5 7&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array xx(3) age sex grade; &lt;/P&gt;&lt;P&gt;array yy(3) newage newsex newgrade;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(xx);&lt;/P&gt;&lt;P&gt;yy(i)=input(xx(i),8.);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop age--grade i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 15:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108805#M22622</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-05-09T15:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108806#M22623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ahhhh...countw() is available in SAS9.2...I want that function! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 15:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108806#M22623</guid>
      <dc:creator>JasonDiVirgilio</dc:creator>
      <dc:date>2012-05-09T15:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108807#M22624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it saves the trouble of writing a macro (or writing a complex %DO&amp;nbsp; loop) to perform the counting.&amp;nbsp; The only problem I have seen is that the macro version&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sysfunc(countw(&amp;amp;varlist))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;complains loudly when the incoming string is null.&amp;nbsp; For some applications, I end up coding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %length(&amp;amp;varlist) %then %do i=1 %to %sysfunc(countw(&amp;amp;varlist));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 15:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108807#M22624</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-09T15:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108808#M22625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Opps. Missing the important thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 07:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108808#M22625</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-10T07:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108809#M22626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quote it.&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Astounding wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Yes, it saves the trouble of writing a macro (or writing a complex %DO&amp;nbsp; loop) to perform the counting.&amp;nbsp; The only problem I have seen is that the macro version&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%sysfunc(countw(&amp;amp;varlist))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;complains loudly when the incoming string is null.&amp;nbsp; For some applications, I end up coding&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%if %length(&amp;amp;varlist) %then %do i=1 %to %sysfunc(countw(&amp;amp;varlist));&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %let varlist=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; %put NOTE: %sysfunc(countw(&amp;amp;varlist));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;ERROR: The function COUNTW referenced by the %SYSFUNC or %QSYSFUNC macro function has too few arguments.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;NOTE: .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp; %put NOTE: %sysfunc(countw(%superQ(varlist)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;NOTE: 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;Seems like all these "solutions" have a major flaw.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;INFORMAT&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;Name is changed&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-size: 8pt; font-family: 'SAS Monospace';"&gt;Label is lost&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 10:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108809#M22626</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-05-10T10:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108810#M22627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent. I should have known ... if you have a problem with a null value, ask data_null_;&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 13:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108810#M22627</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-05-10T13:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to convert character to numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108811#M22628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm very good at nothing.:smileyshocked:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 14:22:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-to-convert-character-to-numeric-variable/m-p/108811#M22628</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-05-10T14:22:25Z</dc:date>
    </item>
  </channel>
</rss>

