<?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 why would that not work? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8263#M272</link>
    <description>why can't the macro variable &amp;amp;lefty in this macro be resolved???&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro info_gain_attrib(attrib);&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=project.merged_pd_data (keep=&amp;amp;attrib  status) out=project.sort_by_&amp;amp;attrib;&lt;BR /&gt;
by &amp;amp;attrib;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select distinct trim(&amp;amp;attrib)||"'n" into :&amp;amp;attrib._1 - :&amp;amp;attrib._4&lt;BR /&gt;
   from project.sort_by_&amp;amp;attrib;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%let lefty=%str(%');&lt;BR /&gt;
&lt;BR /&gt;
%global info_gain_&amp;amp;attrib;&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
   &lt;BR /&gt;
   set project.sort_by_&amp;amp;attrib end=last;&lt;BR /&gt;
   by &amp;amp;attrib;&lt;BR /&gt;
&lt;BR /&gt;
   if first.&amp;amp;attrib then do; &lt;BR /&gt;
    class_N+1;  N=1; count_healthy=0; count_parkinson=0;if status=0 then count_healthy+1;&lt;BR /&gt;
	 else if status=1 then count_parkinson+1;end;&lt;BR /&gt;
&lt;BR /&gt;
   else if last.&amp;amp;attrib then do; &lt;BR /&gt;
              N+1; &lt;BR /&gt;
              if status=0 then count_healthy+1; &lt;BR /&gt;
              else if status=1 then count_parkinson+1;   &lt;BR /&gt;
              p_healthy=count_healthy/N; &lt;BR /&gt;
              p_parkinson=count_parkinson/N; &lt;BR /&gt;
              if class_N=1 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1=N/195; &lt;BR /&gt;
              end;&lt;BR /&gt;
              else if class_N=2 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._2= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2=N/195; &lt;BR /&gt;
              end; &lt;BR /&gt;
              else if class_N=3 then do;&lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3=N/195;&lt;BR /&gt;
              end;&lt;BR /&gt;
              else if class_N=4 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4=N/195; &lt;BR /&gt;
              end;&lt;BR /&gt;
         end;&lt;BR /&gt;
&lt;BR /&gt;
   else do;&lt;BR /&gt;
          N+1;  &lt;BR /&gt;
          if status=0 then count_healthy+1;&lt;BR /&gt;
	      else if status=1 then count_parkinson+1;&lt;BR /&gt;
          end;&lt;BR /&gt;
&lt;BR /&gt;
	 if last then do; &lt;BR /&gt;
              info_&amp;amp;attrib=&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._2+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4;&lt;BR /&gt;
	          info_gain_&amp;amp;attrib=&amp;amp;info_D - info_&amp;amp;attrib;  call symput ('info_&amp;amp;attrib', info_&amp;amp;attrib); call symput ('info_gain_&amp;amp;attrib', info_gain_&amp;amp;attrib);&lt;BR /&gt;
      end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%put The information gain for attribute &amp;amp;attrib is "&amp;amp;&amp;amp;info_gain_&amp;amp;attrib";&lt;BR /&gt;
%mend;</description>
    <pubDate>Tue, 27 Oct 2009 20:04:33 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-27T20:04:33Z</dc:date>
    <item>
      <title>why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8263#M272</link>
      <description>why can't the macro variable &amp;amp;lefty in this macro be resolved???&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro info_gain_attrib(attrib);&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=project.merged_pd_data (keep=&amp;amp;attrib  status) out=project.sort_by_&amp;amp;attrib;&lt;BR /&gt;
by &amp;amp;attrib;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select distinct trim(&amp;amp;attrib)||"'n" into :&amp;amp;attrib._1 - :&amp;amp;attrib._4&lt;BR /&gt;
   from project.sort_by_&amp;amp;attrib;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%let lefty=%str(%');&lt;BR /&gt;
&lt;BR /&gt;
%global info_gain_&amp;amp;attrib;&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
   &lt;BR /&gt;
   set project.sort_by_&amp;amp;attrib end=last;&lt;BR /&gt;
   by &amp;amp;attrib;&lt;BR /&gt;
&lt;BR /&gt;
   if first.&amp;amp;attrib then do; &lt;BR /&gt;
    class_N+1;  N=1; count_healthy=0; count_parkinson=0;if status=0 then count_healthy+1;&lt;BR /&gt;
	 else if status=1 then count_parkinson+1;end;&lt;BR /&gt;
&lt;BR /&gt;
   else if last.&amp;amp;attrib then do; &lt;BR /&gt;
              N+1; &lt;BR /&gt;
              if status=0 then count_healthy+1; &lt;BR /&gt;
              else if status=1 then count_parkinson+1;   &lt;BR /&gt;
              p_healthy=count_healthy/N; &lt;BR /&gt;
              p_parkinson=count_parkinson/N; &lt;BR /&gt;
              if class_N=1 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1=N/195; &lt;BR /&gt;
              end;&lt;BR /&gt;
              else if class_N=2 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._2= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2=N/195; &lt;BR /&gt;
              end; &lt;BR /&gt;
              else if class_N=3 then do;&lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3=N/195;&lt;BR /&gt;
              end;&lt;BR /&gt;
              else if class_N=4 then do; &lt;BR /&gt;
              &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4=N/195; &lt;BR /&gt;
              end;&lt;BR /&gt;
         end;&lt;BR /&gt;
&lt;BR /&gt;
   else do;&lt;BR /&gt;
          N+1;  &lt;BR /&gt;
          if status=0 then count_healthy+1;&lt;BR /&gt;
	      else if status=1 then count_parkinson+1;&lt;BR /&gt;
          end;&lt;BR /&gt;
&lt;BR /&gt;
	 if last then do; &lt;BR /&gt;
              info_&amp;amp;attrib=&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._2+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4;&lt;BR /&gt;
	          info_gain_&amp;amp;attrib=&amp;amp;info_D - info_&amp;amp;attrib;  call symput ('info_&amp;amp;attrib', info_&amp;amp;attrib); call symput ('info_gain_&amp;amp;attrib', info_gain_&amp;amp;attrib);&lt;BR /&gt;
      end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%put The information gain for attribute &amp;amp;attrib is "&amp;amp;&amp;amp;info_gain_&amp;amp;attrib";&lt;BR /&gt;
%mend;</description>
      <pubDate>Tue, 27 Oct 2009 20:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8263#M272</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-27T20:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8264#M273</link>
      <description>It'd be good that you post code that anyone can run.&lt;BR /&gt;
&lt;BR /&gt;
For eg, replace your data with sashelp samples.</description>
      <pubDate>Wed, 28 Oct 2009 00:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8264#M273</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-10-28T00:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8265#M274</link>
      <description>If you have an error, post the SAS log and the specific problem you are experience -- otherwise it's a guessing game because others on the forum have no idea what your data or your SAS environment generate.  Reply to your initial post and provide COPY/PASTE from your SAS log with expanded code and diagnostic messages.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 28 Oct 2009 03:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8265#M274</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-10-28T03:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8266#M275</link>
      <description>I agree with the others comments, &lt;BR /&gt;
&lt;BR /&gt;
but did notice the lefty macro variable only contains a single quote, yet you are placing one at the begining of two lines that look like they are suppose to generate variable assignment clauses, but in fact creates a line of code that contains nothing but a quoted string all by itself followed by valid assignment statement, but not the one I think you want.  &lt;BR /&gt;
&lt;BR /&gt;
What are you trying to accomplish with that macro variable?&lt;BR /&gt;
&lt;BR /&gt;
Have you tried OPTIONS=MPRINT to see what code the macro is generating?&lt;BR /&gt;
&lt;BR /&gt;
Curtis</description>
      <pubDate>Wed, 28 Oct 2009 14:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8266#M275</guid>
      <dc:creator>CurtisMack</dc:creator>
      <dc:date>2009-10-28T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8267#M276</link>
      <description>Sorry for not providing the sample data to test. Actually it is a macro I designed for caculating information gain for a discretized continuous variable.  I open the option ----validvarname=any, so that I can use for example '1.423287 to 1.743867'n as valid variable name. That's all. I just want to put the left " ' " to the left of " 1.423287 to 1.743867'n ".&lt;BR /&gt;
&lt;BR /&gt;
The following scripts may help build the test data set, use it as the data 'sort_by_&amp;amp;attrib'.&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
input  col1 $ 1-20 status 25; &lt;BR /&gt;
datalines;&lt;BR /&gt;
1.423287 to 1.743867    0&lt;BR /&gt;
1.423287 to 1.743867	   1&lt;BR /&gt;
1.423287 to 1.743867	   0&lt;BR /&gt;
1.423287 to 1.743867	   0&lt;BR /&gt;
1.765957 to 2.330716	   1&lt;BR /&gt;
1.765957 to 2.330716	   0&lt;BR /&gt;
1.765957 to 2.330716	   1&lt;BR /&gt;
1.765957 to 2.330716	   0&lt;BR /&gt;
2.33218 to 2.88245	     1&lt;BR /&gt;
2.33218 to 2.88245	     1&lt;BR /&gt;
2.33218 to 2.88245	     1&lt;BR /&gt;
2.33218 to 2.88245	     0&lt;BR /&gt;
2.8923 to 3.671155	     0&lt;BR /&gt;
2.8923 to 3.671155	     1&lt;BR /&gt;
2.8923 to 3.671155	     1&lt;BR /&gt;
2.8923 to 3.671155	     1&lt;BR /&gt;
;</description>
      <pubDate>Wed, 28 Oct 2009 15:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8267#M276</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-28T15:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8268#M277</link>
      <description>It looks to me like you are writting opening the single quote around your variable names, but are forgetting to close them with the 'n.</description>
      <pubDate>Wed, 28 Oct 2009 16:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8268#M277</guid>
      <dc:creator>CurtisMack</dc:creator>
      <dc:date>2009-10-28T16:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8269#M278</link>
      <description>Here is the part of log error.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
MLOGIC(INFO_GAIN_ATTRIB):  %LET (variable name is LEFTY)&lt;BR /&gt;
MLOGIC(INFO_GAIN_ATTRIB):  %GLOBAL  INFO_GAIN_&amp;amp;ATTRIB&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   data test;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   set project.sort_by_D2_class end=last;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   by D2_class;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   if first.D2_class then do;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   class_N+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   N=1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   count_healthy=0;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   count_parkinson=0;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):  if status=0 then count_healthy+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   else if status=1 then count_parkinson+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):  end;&lt;BR /&gt;
4                                        The SAS System        11:19 Wednesday, October 28, 2009&lt;BR /&gt;
&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   else if last.D2_class then do;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   N+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   if status=0 then count_healthy+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   else if status=1 then count_parkinson+1;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   p_healthy=count_healthy/N;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   p_parkinson=count_parkinson/N;&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   if class_N=1 then do;&lt;BR /&gt;
&lt;BR /&gt;
           _&lt;BR /&gt;
           180&lt;BR /&gt;
WARNING: The quoted string currently being processed has become more than 262 characters long.  &lt;BR /&gt;
         You may have unbalanced quotation marks.&lt;BR /&gt;
NOTE: Line generated by the macro variable "D2_CLASS_1".&lt;BR /&gt;
88         info_1.423287 to 1.743867'n&lt;BR /&gt;
                                    __&lt;BR /&gt;
                                    49&lt;BR /&gt;
ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;
&lt;BR /&gt;
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS &lt;BR /&gt;
             release.  Inserting white space between a quoted string and the succeeding &lt;BR /&gt;
             identifier is recommended.&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Line generated by the invoked macro "INFO_GAIN_ATTRIB".&lt;BR /&gt;
88          ('info_&amp;amp;attrib', info_&amp;amp;attrib); call symput ('info_gain_&amp;amp;attrib', info_gain_&amp;amp;attrib)&lt;BR /&gt;
                          ________________________________&lt;BR /&gt;
                          49&lt;BR /&gt;
88       ! ;       end; run;&lt;BR /&gt;
MLOGIC(INFO_GAIN_ATTRIB):  %PUT The information gain for attribute &amp;amp;attrib is &lt;BR /&gt;
      "&amp;amp;&amp;amp;info_gain_&amp;amp;attrib"&lt;BR /&gt;
The information gain for attribute &amp;amp;attrib is "&amp;amp;&amp;amp;info_gain_&amp;amp;attrib"&lt;BR /&gt;
MPRINT(INFO_GAIN_ATTRIB):   'info_1.423287 to 1.743867'n= &lt;BR /&gt;
-p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &lt;BR /&gt;
&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1=N/195;                end;               else if class_N=2 then do;   &lt;BR /&gt;
             &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._2= &lt;BR /&gt;
-p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2);  &lt;BR /&gt;
&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2=N/195;                end;                else if class_N=3 then do;  &lt;BR /&gt;
             &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3= &lt;BR /&gt;
-p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &lt;BR /&gt;
&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3=N/195;               end;               else if class_N=4 then do;    &lt;BR /&gt;
            &amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4= &lt;BR /&gt;
-p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &lt;BR /&gt;
&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4=N/195;                end;          end;     else do;           N+1;  &lt;BR /&gt;
           if status=0 then count_healthy+1;        else if status=1 then count_parkinson+1;    &lt;BR /&gt;
       end;    if last then do;                &lt;BR /&gt;
info_&amp;amp;attrib=&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._2*&amp;amp;lefty&lt;BR /&gt;
.info_&amp;amp;&amp;amp;&amp;amp;attrib._2+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._3*&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._3+&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._4*&lt;BR /&gt;
&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._4;            info_gain_&amp;amp;attrib=&amp;amp;info_D - info_&amp;amp;attrib;  call symput &lt;BR /&gt;
('info_D2_class', info_&amp;amp;attrib); call symput ('info_gain_D2_class&lt;BR /&gt;
MLOGIC(INFO_GAIN_ATTRIB):  Ending execution.</description>
      <pubDate>Wed, 28 Oct 2009 16:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8269#M278</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-28T16:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8270#M279</link>
      <description>Mars:&lt;BR /&gt;
&lt;BR /&gt;
You have run into a tokenization problem.&lt;BR /&gt;
If you run a scanning electon microscope over the documentation you will discover that %str() quotes its arguement at compile time.  When the macro-generated text is fed to the SAS tokenizer it is supposed to be unquoted.&lt;BR /&gt;
The exact rules for when and whether this unquoting occurs are AFAIK undocumented and a trifle erratic.&lt;BR /&gt;
The result is that instead of one token, a quoted string like 'Hello, world' the tokenizer sees four: ', Hello, world, and '.  None of these are valid SAS statements.  Hence the 180 errors.&lt;BR /&gt;
The %unquote() function is the solution for this.  It is possible that changing the initial assignment to:&lt;BR /&gt;
     %let lefty = %unquote(%str(%'));&lt;BR /&gt;
will do it.  If that does not work then use:&lt;BR /&gt;
&lt;BR /&gt;
%unquote(&amp;amp;lefty.info_&amp;amp;&amp;amp;&amp;amp;attrib._1= -p_healthy*log(p_healthy)/log(2)-p_parkinson*log(p_parkinson)/log(2); &amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1=N/195;)&lt;BR /&gt;
&lt;BR /&gt;
and so on, or enclose the whole section of text in a single %unquote()  function.</description>
      <pubDate>Wed, 28 Oct 2009 18:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8270#M279</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-28T18:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: why would that not work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8271#M280</link>
      <description>OldTimer is right. Unquoting is sometimes hit and miss.&lt;BR /&gt;
&lt;BR /&gt;
The only way I could make this work is by using &lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
  select distinct trim(&amp;amp;attrib) into :&amp;amp;attrib._1 - :&amp;amp;attrib._4 from test;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
and then&lt;BR /&gt;
&lt;BR /&gt;
%unquote(&amp;amp;lefty.ratio_&amp;amp;&amp;amp;&amp;amp;attrib._1&amp;amp;lefty.n)=N/195; &lt;BR /&gt;
&lt;BR /&gt;
I am unsure why you'd want to carry these hideous names in the data step instead of calling the new variables INFO1-4 and RATIO1-4 though.&lt;BR /&gt;
&lt;BR /&gt;
This would also allow you to write&lt;BR /&gt;
RATIO[CLASS_N]=N/195; &lt;BR /&gt;
instead of doing successive tests.</description>
      <pubDate>Wed, 28 Oct 2009 22:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-would-that-not-work/m-p/8271#M280</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-10-28T22:32:01Z</dc:date>
    </item>
  </channel>
</rss>

