<?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 Data Quality: check numeric values outside boundary conditions character outside value lis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260051#M50402</link>
    <description>&lt;P&gt;&lt;SPAN&gt;HI RW9, attached you find:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;DC.input_analysis: input data set (data from the proc contents enhanced)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;test: data set to be tested&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- expected results: in green the data that I already get running the proc means below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc means&lt;BR /&gt;data=test STACKODS n nmiss range min max;&lt;BR /&gt;var _numeric_;&lt;BR /&gt;ods output summary=stacked&lt;BR /&gt;;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In yellow the data I would like to get in an easy manner. My idea was: take individually each variable of the data set '&lt;SPAN&gt;DC.input_analysis&lt;/SPAN&gt;' (Macro + loop) and store the result obtained in&amp;nbsp;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;DC.input_analysis&lt;/SPAN&gt;&lt;SPAN&gt;'.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks for your support,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2016 15:36:46 GMT</pubDate>
    <dc:creator>Sir_Highbury</dc:creator>
    <dc:date>2016-03-30T15:36:46Z</dc:date>
    <item>
      <title>Macro Data Quality: check numeric values outside boundary conditions character outside value list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260001#M50382</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have the following table (input_analysis) as result of a proc content:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Library&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Library Member Name&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Data Set&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Special&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Variable Name&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt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&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;BEST&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I enhance the data with the following additional information:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;sql&lt;/STRONG&gt;; create table DC.input_analysis as select t.*&lt;/P&gt;&lt;P&gt;,t1.Variable_Name_Original&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,t1.Variable_Name_English&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,t1.Variable_description&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,t1.Variable_value_list&lt;/P&gt;&lt;P&gt;,t1.Variable_category&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,t1.Variable_min&amp;nbsp;&lt;/P&gt;&lt;P&gt;,t1.Variable_max&lt;/P&gt;&lt;P&gt;from DC.input_analysis t&lt;/P&gt;&lt;P&gt;left outer join In.Variables_information t1 on (t.variable_name=t1.Variable_Name_Original or t.variable_name=t1.Variable_Name_English)&lt;/P&gt;&lt;P&gt;;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;On the basis of the&amp;nbsp;new variables(from Variables_information t1), I should perform some checks on the data related to&amp;nbsp;each observation of the proc contents&amp;nbsp;(e.g. ACTIF contained in Work.Test).&lt;/LI&gt;&lt;LI&gt;I enhance the table with some variables that should be calculated for each observation of the proc content (i. variables in Work.Test)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;sql&lt;/STRONG&gt;; create table DC.input_analysis_result as select&lt;/P&gt;&lt;P&gt;t.*&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as n_missing&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as perc_missing&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as over_up_bound&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as max&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as over_dow_bound&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as min&lt;/P&gt;&lt;P&gt;,&lt;STRONG&gt;0&lt;/STRONG&gt;&amp;nbsp;as n_not_value_list&lt;/P&gt;&lt;P&gt;,"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " as unexpected_values&lt;/P&gt;&lt;P&gt;from DC.input_analysis t ;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I would like to perform some calculations (here below two of them) recursively for each observation of the proc contents (variable name):&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;in the table that I mentioned above (create table DC.input_analysis) there is a variable named Variable_value_list that contains for all the non numeric variables the value lists. E.g. for the Variable Source I have AG, SA. Check requested: running a proc sql for each not numeric variable and grouping by variable in order to get the value list and list all the values that are not in the value list (e.g. I found AB instead of AG and SA put not like in (‘%AG%’,’%SA%’)&lt;/LI&gt;&lt;LI&gt;in the table that I mentioned above (create table DC.input_analysis) I have also to variables, t1.Variable_min,t1.Variable_max indicating the upper and lower bound. Min and max generated within the proc means are already a helpful indication but my aim is also to get the amount of observation for the numeric variables that do not satisfy the boundary conditions.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I automatize these calculation keep it as simple as possible? Thank a lot in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 08:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260001#M50382</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-03-30T08:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260012#M50387</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What may be easier, is if you can post some test data (in the form of a datastep) and what you want the output to look like. &amp;nbsp;I would imagine a simple datastep with call execute() should be able to achieve what you want. &amp;nbsp;Its a bit difficult to say without seeing the actual data and what&amp;nbsp;&lt;SPAN&gt;DC.input_analysis looks like.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data have;
  ab="ABC"; output;
  ab="DEF"; output;
run;
data test;
  var='AB'; test='ABC';
run;
proc sql;
  create table RESULTS (TEST char(200),RESULT char(200));
quit;
data _null_;
  set test;
  call execute('proc sql; insert into RESULTS set TEST="where '||strip(var)||' ne '||strip(test)||'",
                  RESULT=case when exists(select distinct '||strip(var)||' from HAVE where '||strip(var)||' ne "'||strip(test)||'") then "Fail" else "Pass" end; quit;');
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2016 09:35:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260012#M50387</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-30T09:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260051#M50402</link>
      <description>&lt;P&gt;&lt;SPAN&gt;HI RW9, attached you find:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;DC.input_analysis: input data set (data from the proc contents enhanced)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;nbsp;test: data set to be tested&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- expected results: in green the data that I already get running the proc means below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc means&lt;BR /&gt;data=test STACKODS n nmiss range min max;&lt;BR /&gt;var _numeric_;&lt;BR /&gt;ods output summary=stacked&lt;BR /&gt;;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In yellow the data I would like to get in an easy manner. My idea was: take individually each variable of the data set '&lt;SPAN&gt;DC.input_analysis&lt;/SPAN&gt;' (Macro + loop) and store the result obtained in&amp;nbsp;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;DC.input_analysis&lt;/SPAN&gt;&lt;SPAN&gt;'.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks for your support,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 15:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260051#M50402</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-03-30T15:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260074#M50408</link>
      <description>&lt;P&gt;Yes, so you can do something along these lines, within a if block, define the code to be checked and update in your master results table:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set dc.input_analysis;
  if variable_value_list ne "" then do;
    call execute('proc sql; insert into RESULTS select distinct "Value not in list",CATEGORY from HAVE 
                    where CATEGORY not in ("'||strip(tranwrd(variable_value_list,",",'","'))||'");
                  quit;');
  end;
  if variable_min ne "" then do;
    call execute('proc sql; insert into RESULTS select distinct "Not in range",PAYMENT_DATE from HAVE 
                    where PAYMENT_DATE not between input("'||strip(VARIABLE_MIN)||'",ddmmyy10.) and input("'||strip(VARIABLE_MAX)||'",ddmmyy10.);
                  quit;');
  end;
  ...
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2016 13:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260074#M50408</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-30T13:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260143#M50447</link>
      <description>&lt;P&gt;thanks a lot for the suggestion... I will check it.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 15:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/260143#M50447</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-03-30T15:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261026#M50712</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use your code but I am still doing something wron: here the the current version of my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set DC.input_analysis_res;&lt;BR /&gt;if Variable_value_list ne "" then do;&lt;BR /&gt;call execute('proc sql; insert into DC.input_analysis_res select distinct "Unexpected_values", variable_value_list in.test&lt;BR /&gt;where _all_ not in ("'||strip(tranwrd(variable_value_list,",",'","'))||'");&lt;BR /&gt;quit;');&lt;BR /&gt;end;&lt;BR /&gt;/*variable_min ne "" then do;&lt;BR /&gt;call execute('proc sql; insert into outliers_down select distinct "Not in range",PAYMENT_DATE from HAVE&lt;BR /&gt;where PAYMENT_DATE not between input("'||strip(VARIABLE_MIN)||'",ddmmyy10.) and input("'||strip(VARIABLE_MAX)||'",ddmmyy10.);&lt;BR /&gt;quit;');&lt;BR /&gt;end;*/&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached again the input file and the error message I got.&lt;/P&gt;&lt;P&gt;I do not get the role of the variable you described "category". Since I should do the same check for all the the variables I called it _ALL_.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further help on it is welcome.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 13:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261026#M50712</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-04T13:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261027#M50713</link>
      <description>&lt;P&gt;log screenshot&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12424i85EF2AA7E8B7DA21/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="screenshot.PNG" title="screenshot.PNG" /&gt;</description>
      <pubDate>Mon, 04 Apr 2016 09:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261027#M50713</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-04T09:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261031#M50715</link>
      <description>&lt;PRE&gt;data _null_;
  set DC.input_analysis_res;
  if Variable_value_list ne "" then do;
    call execute('proc sql; 
                    insert into DC.input_analysis_res 
                    select distinct "Unexpected_values", variable_value_list in.test
                    where _all_ not in ("'||strip(tranwrd(variable_value_list,",",'","'))||'");
                  quit;');
  end;
run;&lt;/PRE&gt;
&lt;P&gt;Well, I am not sure what:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;variable_value_list in.test&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Is meant to be, its not valid SQL syntaxt. &amp;nbsp;If you take in.test out, add a from statement, and remove the _ALL_ reference it should work. &amp;nbsp;Oh, one thing you might need to bear in mind, if you put a long string in there, you will get a warning to indicate long string, to avoid this use:&lt;BR /&gt;options noquotelenmax;&lt;/P&gt;
&lt;P&gt;Before, and afterwards:&lt;/P&gt;
&lt;P&gt;options quotelenmax;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One other thing to remember, you can put your actual code in a macro and call that, this may help organisation:&lt;/P&gt;
&lt;PRE&gt;%macro In_list (var=,vals=);
  proc sql; 
    insert into DC.input_analysis_res 
    select distinct "Unexpected_values", variable_value_list in.test
    where  &amp;amp;VAR. not in (&amp;amp;VALS.);
  quit;
%mend In_List;

data _null_;
  set DC.input_analysis_res;
  if Variable_value_list ne "" then call execute('%In_List (var='||strip(var)||',vals=',strip(variable_value_list),');');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 09:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261031#M50715</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-04T09:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261052#M50724</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the structure with the macrois at list for me better organized and I prefer it but still, I do not get what I want. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Based on my understanding:&lt;/P&gt;&lt;P&gt;1. you check for each row of the table DC.input_analysis_res if the variable&amp;nbsp;Variable_value_list is not empty, in case not you go to the next step;&lt;/P&gt;&lt;P&gt;2. using call execute you call the specified macro, defining the required inputs:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2a.&amp;nbsp;var='||strip(var)||;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2b.&amp;nbsp;vals=',strip(variable_value_list);&lt;/P&gt;&lt;P&gt;3. the macro recursively for each row, select the variable (colum) in the table test (e.g. Nationality) extracts all the values assumed (e.g. Jpanese, French...) &amp;nbsp;that are not &amp;nbsp;&amp;amp;vals;&lt;/P&gt;&lt;P&gt;4. the values selected in 3 are stored as variable "Unexpected_values" in&amp;nbsp;DC.input_analysis_res.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I understand correctly?&lt;/P&gt;&lt;P&gt;Here the part that I am using for the debug and attached the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro In_list (var=,vals=);&lt;BR /&gt;proc sql;&lt;BR /&gt;insert into DC.input_analysis_res&lt;BR /&gt;select distinct&lt;BR /&gt;"Unexpected_values",&lt;BR /&gt;variable_value_list in.test&lt;BR /&gt;where &amp;amp;VAR. not in (&amp;amp;VALS.);&lt;BR /&gt;quit;&lt;BR /&gt;%mend In_List;&lt;BR /&gt;data _null_;&lt;BR /&gt;set DC.input_analysis_res;&lt;BR /&gt;if Variable_value_list ne "" then call execute('%In_List (var='||strip(var)||',vals=',strip(variable_value_list),');');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* debug:&lt;BR /&gt;proc sql; create table aaa as select &amp;amp;var., count(*) as n from in.test where &amp;amp;var. not in (&amp;amp;vals.) group by &amp;amp;var.; run;&lt;BR /&gt;proc sql; create table aaa as select segment, count(*) as n from in.test where segment not in (&amp;amp;vals.) group by segment; run;&lt;BR /&gt;*/&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12425iF9FB00E04A098D43/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="screenshot_2.PNG" title="screenshot_2.PNG" /&gt;</description>
      <pubDate>Mon, 04 Apr 2016 11:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261052#M50724</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-04T11:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261058#M50727</link>
      <description>&lt;P&gt;The error is here:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if Variable_value_list ne "" then call execute('%In_List (var='||strip(var)||',vals=',strip(variable_value_&lt;/SPAN&gt;&lt;WBR /&gt;&lt;SPAN&gt;list),');');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Should be&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if Variable_value_list ne "" then call execute('%In_List (var='||strip(var)||',vals='||strip(variable_value_&lt;WBR /&gt;&lt;SPAN&gt;list)||');');&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;You use commas when using a function to concatenate, e.g. cat("abc","def"). &amp;nbsp;Your not in this instance so you ues the double bars. &amp;nbsp;Call execute accepts one string. &amp;nbsp;That is what your basically doing here creating a string which then gets pushed out after the datastep stops. &amp;nbsp;That string then becomes code, &amp;nbsp;so is then syntax checked and compiled. &amp;nbsp;If you struggling, check your string looks right first.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 12:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261058#M50727</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-04T12:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261078#M50732</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it gets better and better and when it will be working I can also adapt the same macro for defferent purposes but still&amp;nbsp;not get the data I want. I googled &amp;nbsp;for the error and I tryit to get more information from the debug (Options nomacrogen NoSymbolgen nomlogic nomprint nomfile.) but I do not get why the variable var is not initialized:&amp;nbsp;ERROR: All positional parameters must precede keyword parameters.&amp;nbsp;Attached the log.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12426iAA72CE72F56A44E3/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="screenshot3.PNG" title="screenshot3.PNG" /&gt;</description>
      <pubDate>Mon, 04 Apr 2016 13:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261078#M50732</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-04T13:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261084#M50737</link>
      <description>&lt;P&gt;The clue here is in the NOTE: Variable var is uninitialised. &amp;nbsp;In your dataset DC.input_analysis_res, look for the variable containing the variable name of the test in question - could it be variable_name_english? &amp;nbsp;The second thing to check, and I can't see it here, is what does variable_value_list contain, is there some values with a comma, e.g. A,B,D? &amp;nbsp;If so then you will need to pass it as a string:&lt;/P&gt;
&lt;P&gt;if ... call execute('%In_List (var='||strip(variable_name_english)||',vals="'||strip(variable_value_list)||'");');&lt;/P&gt;
&lt;P&gt;Note the double quotes after vals=. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 13:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261084#M50737</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-04T13:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261442#M50886</link>
      <description>&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the indication, I now replaced all the "," used to separate the value in the value list with "_" and I do not get the error message anymore. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyway I am still struggling with a syntax error (attachment). Any idea? Thanks again.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12428iDF8CBA08A20CFAD1/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="screenshot3.PNG" title="screenshot3.PNG" /&gt;</description>
      <pubDate>Tue, 05 Apr 2016 15:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261442#M50886</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-05T15:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261626#M50955</link>
      <description>&lt;P&gt;Your text is still being generated as:&lt;/P&gt;
&lt;P&gt;...select distinct "Unexepected values",variable_value_list in.test where . not in...&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^ &amp;nbsp; &amp;nbsp; &amp;nbsp;^&lt;/P&gt;
&lt;P&gt;The indicated part is not valid syntax.&lt;/P&gt;
&lt;P&gt;Also, you have warnings about the variable VAR not existing in dataset DC.input_analysis_res, that is also why you have the var uninitialised. &amp;nbsp;I can't see where it is coming from, you would need to show the macro, and the dataset (at least a few lines of it) which feed into it.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 08:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261626#M50955</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-06T08:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261721#M50974</link>
      <description>&lt;P&gt;Dear RW,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry but I am getting confuse, let me do a short recap:&lt;/P&gt;&lt;P&gt;1. DC.Input_analysis_res is created as a result of a proc contents (in this case of the file in.test)&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc contents data=in.test&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;out=DC.input_analysis noprint&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;some variables are dropped and other renamed:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc sql; create table DC.input_analysis as select &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;(cats(trim(t.LIBNAME),trim(t.MEMNAME),trim(t.NAME))) as unique_ID_data_checks&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.LIBNAME as library_name&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.MEMNAME as data_set_name&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.NAME as variable_name&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.FORMAT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.LENGTH&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.NOBS as observation_number&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t.MODATE as Last_Modified_Date from DC.input_analysis t ;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;3. the following vatiables are added (e.g &lt;STRONG&gt;Variable_value_list&lt;/STRONG&gt;) using an external data source:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc sql; create table DC.input_analysis as select t.* &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_Name_Original &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_Name_English &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_description /* variable description */ &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,&lt;STRONG&gt;t1.Variable_value_list&lt;/STRONG&gt; /* possible values (not comma separated!!!!!!) */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Default_value&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_category /* Classification: date, amount, ID, key */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_min /* lower bound */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;,t1.Variable_max /* upper bound */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;from DC.input_analysis t &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;left outer join In.Variables_information t1 on (t.variable_name=t1.Variable_Name_Original or t.variable_name=t1.Variable_Name_English)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;run;&lt;/FONT&gt;&lt;BR /&gt;4. run the proc means and get already for the numeric variable in test the following information:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc means&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;data=in.test STACKODS &lt;STRONG&gt;n nmiss range min max&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;var _numeric_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;ods output summary=DC.stacked&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;5.&lt;/FONT&gt;&lt;FONT color="#000000"&gt;Create the table&amp;nbsp;&lt;SPAN&gt;DC.input_analysis_res where: the data from input analysis are taken and enhanced with the ones from&amp;nbsp;DC.stacked and additionally 3 new variable are created (in bold):&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;proc sql;&lt;BR /&gt;create table DC.input_analysis_res as&lt;BR /&gt;select t1.*, t2.*,&lt;BR /&gt;&lt;STRONG&gt;0 as outliers_up,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;0 as outliers_down,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;" " as Unexpected_values&lt;/STRONG&gt;&lt;BR /&gt;from DC.input_analysis t1 left outer join DC.stacked t2 on t1.variable_name=t2.Variable&lt;BR /&gt;;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Till the point 5 everything is running smoothly. Now I should perform some checks that the command&amp;nbsp;&lt;SPAN&gt;STACKODS was not able to do. For instance: find&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;the value for each&amp;nbsp;observation in&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;DC.input_analysis_res,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;on the basis of &lt;STRONG&gt;Variable_value_list&lt;/STRONG&gt; I would like to fill the variable&amp;nbsp;&lt;STRONG&gt;Unexpected_values. &lt;/STRONG&gt;How?Taking each observation of the variable&amp;nbsp;&lt;STRONG&gt;variable_name &lt;/STRONG&gt;in&lt;STRONG&gt;&amp;nbsp;DC.input_analysis_res &lt;/STRONG&gt;as variable in &lt;STRONG&gt;in.test &lt;/STRONG&gt;and comparing the value of all observation for each variable with the value list given in&amp;nbsp;&lt;STRONG&gt;DC.input_analysis_res&lt;/STRONG&gt; (field&amp;nbsp;&lt;STRONG&gt;Variable_value_list&lt;/STRONG&gt;). In order to get what I want at the point 5, the macro you suggested seems to be the (almost) the perfect solution:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;%macro In_list (var=,vals=);&lt;BR /&gt;Options nomacrogen NoSymbolgen nomlogic nomprint nomfile;&lt;BR /&gt;proc sql;&lt;BR /&gt;insert into DC.input_analysis_res&lt;BR /&gt;select distinct&lt;BR /&gt;"Unexpected_values",&lt;BR /&gt;variable_value_list in.test&lt;BR /&gt;where &amp;amp;VAR. not in (&amp;amp;VALS.);&lt;BR /&gt;quit;&lt;BR /&gt;%mend In_List;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set DC.input_analysis_res;&lt;BR /&gt;if Variable_value_list ne "" then call execute('%In_List (var='||strip(var)||',vals='||strip(variable_value_list)||');');&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coming back to your question:&lt;/P&gt;&lt;P&gt;in in.test there&amp;nbsp;is no variable named&amp;nbsp;&lt;STRONG&gt;Variable_value_list&lt;/STRONG&gt; (this was the input and it should remanin unchanged, the value list is given for each variable by all the observations).&lt;/P&gt;&lt;P&gt;in&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;DC.input_analysis_res &lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;there is the&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; variable&amp;nbsp;Variable_value_list &lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;since it was taken as enahncement (left outer join) if the name would &lt;/FONT&gt;&lt;FONT color="#000000"&gt;be&amp;nbsp;worng, I would not&amp;nbsp;get it in&amp;nbsp;&lt;STRONG&gt;DC.input_analysis_res.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Did we have the same understanding of the same Situation? Thanks a lot RW9.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 14:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261721#M50974</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-06T14:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261723#M50975</link>
      <description>&lt;P&gt;Attached an extraction from&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;DC.input_analysis_res&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 14:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261723#M50975</guid>
      <dc:creator>Sir_Highbury</dc:creator>
      <dc:date>2016-04-06T14:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Data Quality: check numeric values outside boundary conditions character outside value lis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261810#M51013</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, I am not writing it for you. &amp;nbsp;Here is an example using sashelp.class and a input dataset. &amp;nbsp;Basically the idea is from your test metadata, to generate a call out to one of the test macros. &amp;nbsp;You can have as many test macros, or calls to them as you like:&lt;/P&gt;
&lt;PRE&gt;data input_analysis_res;
  length variable_name_original variable_list variable_min variable_max $200;
  variable_name_original="NAME"; output;
  variable_name_original="SEX"; variable_list="M F"; output;
  variable_list="";
  variable_name_original="AGE"; variable_min="14"; variable_max="20"; output;
  variable_name_original="HEIGHT"; variable_min="57"; variable_max="63"; output;
  variable_name_original="WEIGHT"; variable_min="90"; variable_max="120"; output;
run;

proc sql;
  create table RESULTS (VAR char(200),TEST char(200),ID char(200),VAL char(200));
quit;

%macro Check_List (ds=,var=,vlist=);
  proc sql;
    insert into RESULTS 
    select  distinct
            "&amp;amp;VAR.",
            "In List",
            NAME,
            &amp;amp;VAR.
    from    &amp;amp;DS.
    where   &amp;amp;VAR. not in (&amp;amp;VLIST.);
  quit;
%mend Check_List;

%macro Check_Range (ds=,var=,vmin=,vmax=);
  proc sql;
    insert into RESULTS
    select  distinct
            "&amp;amp;VAR.",
            "Outside Range &amp;amp;VMIN. - &amp;amp;VMAX.",
            NAME,
            strip(put(&amp;amp;VAR.,best.))
    from    &amp;amp;DS.
    where   &amp;amp;VAR. not between &amp;amp;VMIN. and &amp;amp;VMAX.;
  quit;
%mend Check_Range;

data _null_;
  set input_analysis_res;
  if variable_list ne "" then 
    call execute(cats('%Check_List (ds=sashelp.class,var=',variable_name_original,',vlist="',tranwrd(strip(variable_list)," ",'" "'),'");'));
  if variable_min ne "" then 
    call execute(cats('%Check_Range (ds=sashelp.class,var=',variable_name_original,',vmin=',variable_min,',vmax=',variable_max,');'));
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2016 16:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Data-Quality-check-numeric-values-outside-boundary/m-p/261810#M51013</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-06T16:13:45Z</dc:date>
    </item>
  </channel>
</rss>

