<?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: Quoting Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267924#M52994</link>
    <description>The error message is saying that the variable X was not found in the contributing tables. Perhaps you meant to reference the variable RULE?  It's hard to guess.</description>
    <pubDate>Tue, 03 May 2016 13:25:20 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2016-05-03T13:25:20Z</dc:date>
    <item>
      <title>Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267917#M52991</link>
      <description>&lt;P&gt;Hi. I have the following line of code. My goal is to set Rule = 'X' when Rule is missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    rule = tranwrd(rule,"SYSDATE",'X');&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However I'm getting the following error (I think) because the value X isn't resolving as 'X'. &amp;nbsp;Does anyone have thoughts on resolving this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;9    + proc sql;
9    +                   create table QueryData as         (       select 'ACTUAL DELIVERY DATE MISMATCH' as RULE_NM,
       b.actual_dlvry_date as AD_DT,                 b.imb_code,                 2 as rule_order                 from
10   + iv_ora.bi_spm_piece_recon a,  bids_ora.bi_spm_piece_recon b                 where a.imb_code = b.imb_code
  and COALESCE(A.ACTUAL_DLVRY_DATE,X) &amp;lt;&amp;gt; COALESCE(B.ACTUAL_DLVRY_DATE,X)         );
ERROR: The COALESCE function requires its arguments to be of the same data type.
ERROR: The COALESCE function requires its arguments to be of the same data type.
ERROR: The following columns were not found in the contributing tables: X.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 13:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267917#M52991</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-03T13:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267920#M52992</link>
      <description>&lt;P&gt;I can't see the relation to the log and the code you've posted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The = sytnax is used in a data step not proc sql...&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 13:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267920#M52992</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-03T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267922#M52993</link>
      <description>&lt;P&gt;Sorry, here's the code relating to the above log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		proc sql;
		create table QueryData as 
		(       select b.actual_dlvry_date as AD_DT, 
				b.imb_code, 
				&amp;amp;rule_order as rule_order
	            from iv_ora.bi_spm_piece_recon a,  bids_ora.bi_spm_piece_recon b                                                                                                                                                                                                                                                                                                                                                                                                                                                   
	            where a.imb_code = b.imb_code
	            and &amp;amp;rule
		); 
		quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 May 2016 13:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267922#M52993</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-03T13:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267924#M52994</link>
      <description>The error message is saying that the variable X was not found in the contributing tables. Perhaps you meant to reference the variable RULE?  It's hard to guess.</description>
      <pubDate>Tue, 03 May 2016 13:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267924#M52994</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-05-03T13:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267928#M52995</link>
      <description>I was talking about the error: ERROR: The COALESCE function requires its arguments to be of the same data type.</description>
      <pubDate>Tue, 03 May 2016 13:32:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267928#M52995</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-03T13:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267931#M52997</link>
      <description>&lt;P&gt;Lets start again. &amp;nbsp;You have this code:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
		create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; QueryData as 
		&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;       &lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;actual_dlvry_date as AD_DT&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; 
				b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;imb_code&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; 
				&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;rule_order as rule_order
	            &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; iv_ora&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;bi_spm_piece_recon a&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;  bids_ora&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;bi_spm_piece_recon b                                                                                                                                                                                                                                                                                                                                                                                                                                                   
	            &lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;imb_code &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; b&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;imb_code
	            and &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;rule
		&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
		&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the macro variable &amp;amp;RULE is resolving to:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;COALESCE&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;A&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;X&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;COALESCE&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;B&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;X&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Now, what the error is telling you is that X is not a variable in any of the contributing tables. &amp;nbsp;I assume what you want to do is to take the character X if the variable is null, so you want &amp;amp;RULE to resolve to:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;COALESCE&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;A&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE&lt;SPAN class="token punctuation"&gt;,"&lt;/SPAN&gt;X"&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;COALESCE&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;B&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ACTUAL_DLVRY_DATE&lt;SPAN class="token punctuation"&gt;,"&lt;/SPAN&gt;X"&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that is how you need to setup the &amp;amp;RULE macro variable. &amp;nbsp;As we can't see how this is set - or in fact see any reason why that bit of code is in a macro variable in the first place, its hard to say where your going wrong. &amp;nbsp;I would suggest that your logic is in the first place incorrect, if either of those variables are actually date variables then "X" will not be valid compare.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post some test data - in the form of a datastep and what you want the output to look like.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 13:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267931#M52997</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-03T13:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267934#M52998</link>
      <description>&lt;P&gt;I believe the cause is the code you generated refers to a variable named X which doesn't exist in the contributing tables.&amp;nbsp; Then SAS will likely assume X is numeric, and your variable actual_delivery_date is probably character.&amp;nbsp; I would start by reviewing the code that generates the where clause.&amp;nbsp; Do really intend to refer to a variable named X?&amp;nbsp; If so, check why this variables isn't being found.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 13:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267934#M52998</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-05-03T13:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267965#M53002</link>
      <description>&lt;P&gt;It seems to be the same issue you asked yesterday...you have a date in one part, the second part X needs to be a date. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still don't know what your first line of Rule= has to do with the code, what are you expecting to happen with that line of code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Two other things:&lt;/P&gt;
&lt;P&gt;If you want to use coalesce with character variables use COALESCEC- but since this is a date variable that doesn't make sense either.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;&amp;gt; resolves to either MAX or NE depending on the usage, the log will state which one. This isn't a native SAS operator so if it was me, I would use NE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 14:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267965#M53002</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-03T14:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267992#M53008</link>
      <description>&lt;P&gt;Just a side note: The &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/69049/HTML/default/viewer.htm#p1gdr5t7sd3g3qn1d7fg23zuwzml.htm" target="_blank"&gt;COALESCE function &lt;EM&gt;of PROC SQL&lt;/EM&gt;&lt;/A&gt; is different from the &lt;EM&gt;data step&lt;/EM&gt; functions &lt;A href="http://support.sas.com/documentation/cdl//en/lefunctionsref/67960/HTML/default/viewer.htm#p1vjttz6nuankzn1gh4z3wgcu0bf.htm" target="_blank"&gt;COALESCE&lt;/A&gt; and &lt;A href="http://support.sas.com/documentation/cdl//en/lefunctionsref/67960/HTML/default/viewer.htm#p1g9btrql8d9x6n1iz6yowaqrq1v.htm" target="_blank"&gt;COALESCEC&lt;/A&gt; in that it accepts both numeric and character arguments as long as all arguments are of the same type.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 16:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-Help/m-p/267992#M53008</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-03T16:09:27Z</dc:date>
    </item>
  </channel>
</rss>

