<?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 - A character operand was found in the %EVAL function or %IF condition where a nume in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466415#M285287</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The use of &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;gt;&lt;/FONT&gt; as an operator in the &lt;FONT face="courier new,courier"&gt;%if&lt;/FONT&gt; statement is not valid. You can for example use &lt;FONT face="courier new,courier"&gt;ne&lt;/FONT&gt; instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the section on Operands and Operators in:&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/62978/HTML/default/viewer.htm#n1alyfc9f4qrten10sd5qz5e1w5q.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#n1alyfc9f4qrten10sd5qz5e1w5q.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might find you have other issues, for example consider using &lt;FONT face="courier new,courier"&gt;%eval&lt;/FONT&gt; for integer arithmetic in the &lt;FONT face="courier new,courier"&gt;%do %until&lt;/FONT&gt; loop control, for starters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Corrected "operand" to be "operator".&lt;/P&gt;</description>
    <pubDate>Thu, 31 May 2018 12:56:22 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2018-05-31T12:56:22Z</dc:date>
    <item>
      <title>Macro: error - A character operand was found in the %EVAL function or %IF condition where a numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466398#M285286</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i recive this error:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
       operand is required. The condition was: &amp;amp;N = 1 AND &amp;amp;MESE_PARTENZA &amp;lt;&amp;gt; -12
ERROR: The macro LOOPMONTH will stop executing.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;from this macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%LET DT_START='30APR2018'D; 
%LET PERIDO=12; 
%LET TERM_YM =201804;  
%LET YM = 052018;
%let STRANA = TGSTRANA;  
%let TGERCOM = tggercom; 

/*LDS*/
%LET DT_START_LDS='30APR2018'D; 
%LET PERIDO_LDS=12; 
%LET PERIDO_LDS_PRE = 3; 



 
%macro loopMonth  (PERIDO_LDS_PRE, NAME, MESE_PARTENZA );

  	%let N =1;


    %do %UNTIL( &amp;amp;N = &amp;amp;PERIDO_LDS_PRE + 1)  ;
	 
   	  %if &amp;amp;N = 1 AND  &amp;amp;MESE_PARTENZA  = -12  %then %LET DT_MONTH_LDS = &amp;amp;DT_START_LDS; 
	  %if &amp;amp;N = 1 AND  &amp;amp;MESE_PARTENZA &amp;lt;&amp;gt; -12  %then %LET DT_MONTH_LDS = intnx('month',&amp;amp;DT_MONTH_LDS, &amp;amp;MESE_PARTENZA);  
   	  %if &amp;amp;N &amp;gt; 1 %then %LET DT_MONTH_LDS = intnx('month',&amp;amp;DT_MONTH_LDS, -1);  

		data _null_;
		 call symput('YEAR', YEAR(&amp;amp;DT_MONTH_LDS) );  
		 call symput('MONTH', month(&amp;amp;DT_MONTH_LDS));
		 run;

		data _null_;
		 call symput('YEARMONTH',cats( put(&amp;amp;YEAR.,z4.),put(&amp;amp;MONTH.,z2.)));
		 call symput('YEARMONTH_M',cats(  substr( PUT(&amp;amp;YEAR.,Z4.), length(PUT(&amp;amp;YEAR.,Z4.)) - 1,2), put(&amp;amp;MONTH.,z2.),  'ATMWEB.mdb'  )  );  /* mdb    accdb */
 		 call symput('YEARMONTH_M2',cats(  substr( PUT(&amp;amp;YEAR.,Z4.), length(PUT(&amp;amp;YEAR.,Z4.)) - 1,2), put(&amp;amp;MONTH.,z2.) )  );
		 call symput('MONTH', put(&amp;amp;MONTH.,z2.));
		 call symput('MOLOGATM',cats('MOLOGATM', put(&amp;amp;YEAR.,z4.),put(&amp;amp;MONTH.,z2.)));
		run;
 		

		%put NOTE: &amp;amp;N; 
				
 
					PROC SQL;  
						CREATE TABLE WORK.&amp;amp;NAME&amp;amp;&amp;amp;N AS 
						
						SELECT &amp;amp;YEARMONTH AS YEARMONTH, 
						C.keyatm,  
	 
						/* TOLGO I VALORI ZERO PER NON FALSARE LA MEDIA */
						(CASE
						WHEN C.LdS_prelievo = 0     THEN  .
		 		        ELSE ROUND(C.LdS_prelievo/100,0.0001)
				        END)  as  LDS_PREL LABEL='LDS_PREL', 
		
						(CASE
				        WHEN C.Lds_Vers_Assegni = 0     THEN  .
		 		        ELSE ROUND(C.Lds_Vers_Assegni/100,0.0001)
				        END) AS LDS_VER_AS LABEL='LDS_VER_AS', 


						(CASE
				        WHEN C.LdS_Vers_Contanti = 0     THEN  .
		 		        ELSE ROUND(C.LdS_Vers_Contanti/100,0.0001)
				        END) AS LDS_VER_CO LABEL='LDS_VER_CO'
						,
						c.Carico_filiale,
						c.Carico_problemi_linee,
						c.Carico_assistenza,
						c.Carico_varie_e_inceppamenti, 
						c.Carico_vigilanza

						FROM  LDS.Tcol54_&amp;amp;YEARMONTH_M2  c
				 			
						;	
					quit;
 

	%let N=%eval(&amp;amp;N +1);
   %end;
%mend loopMonth;

 %loopMonth (&amp;amp;PERIDO_LDS_PRE, Z_PRE_A_ , -12 );     
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone give me advice on how to solve?&lt;/P&gt;
&lt;P&gt;thank's so much&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 11:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466398#M285286</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2018-05-31T11:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro: error - A character operand was found in the %EVAL function or %IF condition where a nume</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466415#M285287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The use of &lt;FONT face="courier new,courier"&gt;&amp;lt;&amp;gt;&lt;/FONT&gt; as an operator in the &lt;FONT face="courier new,courier"&gt;%if&lt;/FONT&gt; statement is not valid. You can for example use &lt;FONT face="courier new,courier"&gt;ne&lt;/FONT&gt; instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the section on Operands and Operators in:&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/62978/HTML/default/viewer.htm#n1alyfc9f4qrten10sd5qz5e1w5q.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#n1alyfc9f4qrten10sd5qz5e1w5q.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might find you have other issues, for example consider using &lt;FONT face="courier new,courier"&gt;%eval&lt;/FONT&gt; for integer arithmetic in the &lt;FONT face="courier new,courier"&gt;%do %until&lt;/FONT&gt; loop control, for starters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Corrected "operand" to be "operator".&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 12:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466415#M285287</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2018-05-31T12:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro: error - A character operand was found in the %EVAL function or %IF condition where a nume</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466419#M285288</link>
      <description>&lt;P&gt;What is it your trying to do?&amp;nbsp; Macro is not the place to be doing data processing, and from the looks of it your breaking data up into smaller bits and putting data into dataset names:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;CREATE &lt;SPAN class="token statement"&gt;TABLE&lt;/SPAN&gt; WORK&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;NAME&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;N&lt;/SPAN&gt; AS&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is rarely a good idea to split like data into blocks, this will just increase storage needs, make your code slower, and you will have to write a lot more messy code.&amp;nbsp; SAS has built in, and very powerful by group processing to handle these types of things.&amp;nbsp; In you main dataset, just add another variable which is the grouping - what you would put in the &amp;amp;name&amp;amp;&amp;amp;n - then use this as by &amp;lt;thevariable&amp;gt;;&amp;nbsp; Far simpler, quicker, less storage etc. and just better all round.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 May 2018 12:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-error-A-character-operand-was-found-in-the-EVAL-function/m-p/466419#M285288</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-31T12:41:49Z</dc:date>
    </item>
  </channel>
</rss>

