<?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: Optimization in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/595028#M171104</link>
    <description>&lt;P&gt;This is untested, but looks like it should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_name=test;

proc sql noprint;
select catx(' ',col_nm,operant,value)
  into :where separated by ' or '
  from oper_flt
  where TBL_NM="&amp;amp;table_name";
  ;
create table oper_flt2 as select flt_id from &amp;amp;table_name
  where &amp;amp;where ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I say "should work" it means you have to test it since you have the data.&amp;nbsp; This code should produce the same result as your original code, except that the final data set name is OPER_FLT2 instead of replacing OPER_FLT.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2019 12:42:27 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-10-09T12:42:27Z</dc:date>
    <item>
      <title>Optimization</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/594964#M171079</link>
      <description>&lt;P&gt;Is there a chance to combine the below steps into 2 or 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_name=test;

data want (keep=flt_id col_nm operant value );
set oper_flt;
where TBL_NM="&amp;amp;table_name";
run;

proc sql noprint;
select catx(' ',col_nm,operant,value)
  into :where separated by ' or '
  from want
;
quit;

proc sql;
create table temp as select * from &amp;amp;table_name
 where &amp;amp;where ;
run;

data oper_flt (keep=flt_id);
set temp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Oct 2019 07:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/594964#M171079</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-09T07:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/594983#M171088</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't really understand what the last datastep is for so i ignored it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_name=sashelp.class;

data oper_flt;
    infile cards dlm=',' dsd;
    length table_name $32 col_nm $32 operant $2;
    input flt_id table_name col_nm operant value;
    cards;
1,sashelp.class,age,=,12
1,sashelp.class,weight,ge,90
;
run;

data _NULL_;
    call execute('proc sql noprint; CREATE TABLE want AS SELECT * FROM &amp;amp;table_name. WHERE ');

    do until(fend);
        set oper_flt (where=(table_name="&amp;amp;table_name.")) end=fend;
        call execute(catx(' ', col_nm, operant, value, 'OR'));
    end;
    call execute('0; quit;');
    stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Oct 2019 09:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/594983#M171088</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-10-09T09:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/595028#M171104</link>
      <description>&lt;P&gt;This is untested, but looks like it should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_name=test;

proc sql noprint;
select catx(' ',col_nm,operant,value)
  into :where separated by ' or '
  from oper_flt
  where TBL_NM="&amp;amp;table_name";
  ;
create table oper_flt2 as select flt_id from &amp;amp;table_name
  where &amp;amp;where ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I say "should work" it means you have to test it since you have the data.&amp;nbsp; This code should produce the same result as your original code, except that the final data set name is OPER_FLT2 instead of replacing OPER_FLT.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 12:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimization/m-p/595028#M171104</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-09T12:42:27Z</dc:date>
    </item>
  </channel>
</rss>

