<?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 fedsql date comparison against macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/fedsql-date-comparison-against-macro-variable/m-p/801958#M315661</link>
    <description>&lt;P&gt;How to transfer the sql code (working) to its fedsql silbing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
		create table sum22 as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= month(intnx('month', today(), -7, 'end')) and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But in fedsql it gives an &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Function MONTH(DOUBLE) does not exist&lt;/STRONG&gt;&lt;/FONT&gt; so I circumvent to this unefficient code.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
source MPG_toyota;
		create table public.sum22{options replace=true} as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= month(intnx('month', today(), -7, 'end'))  and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year  ;
endsource;
fedSQL.execDirect / query=MPG_toyota;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
format _fecha_cierre date9.;
_fecha_cierre=intnx('month', today(), -7, 'end');
call symputx("fecha_cierre", _fecha_cierre);
run;

%let tt=%sysfunc(putn(&amp;amp;fecha_cierre., month.));
%put &amp;amp;fecha_cierre. &amp;amp;tt.;

proc cas;
source MPG_toyota;
		create table public.sum22{options replace=true} as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= &amp;amp;tt. and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year  ;
endsource;
fedSQL.execDirect / query=MPG_toyota;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 15:32:40 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2022-03-14T15:32:40Z</dc:date>
    <item>
      <title>fedsql date comparison against macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fedsql-date-comparison-against-macro-variable/m-p/801958#M315661</link>
      <description>&lt;P&gt;How to transfer the sql code (working) to its fedsql silbing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
		create table sum22 as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= month(intnx('month', today(), -7, 'end')) and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But in fedsql it gives an &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Function MONTH(DOUBLE) does not exist&lt;/STRONG&gt;&lt;/FONT&gt; so I circumvent to this unefficient code.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
source MPG_toyota;
		create table public.sum22{options replace=true} as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= month(intnx('month', today(), -7, 'end'))  and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year  ;
endsource;
fedSQL.execDirect / query=MPG_toyota;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
format _fecha_cierre date9.;
_fecha_cierre=intnx('month', today(), -7, 'end');
call symputx("fecha_cierre", _fecha_cierre);
run;

%let tt=%sysfunc(putn(&amp;amp;fecha_cierre., month.));
%put &amp;amp;fecha_cierre. &amp;amp;tt.;

proc cas;
source MPG_toyota;
		create table public.sum22{options replace=true} as 
			select a.*, b.fini, put(a.year,4.) as _year 
               from PUBLIC.ALL_MONTHLY_COPY a   join 
					(select sum(fin) as fini, from_brand, year from 
					PUBLIC.ALL_MONTHLY_COPY where  month(mes) &amp;lt;= &amp;amp;tt. and 
					lowcase(producto) &amp;lt;&amp;gt; 'other' AND (VN_VN ='10' or VN_VN = '11') group by from_brand, year 
					) b 
			on a.from_brand=b.from_brand and a.year=b.year  ;
endsource;
fedSQL.execDirect / query=MPG_toyota;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 15:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fedsql-date-comparison-against-macro-variable/m-p/801958#M315661</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-03-14T15:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: fedsql date comparison against macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fedsql-date-comparison-against-macro-variable/m-p/801966#M315663</link>
      <description>&lt;P&gt;Could you share some more log?&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 16:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fedsql-date-comparison-against-macro-variable/m-p/801966#M315663</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-03-14T16:25:23Z</dc:date>
    </item>
  </channel>
</rss>

