<?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: Ask the expert / How to validate a SAS dataset with respect to predefined criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Ask-the-expert-How-to-validate-a-SAS-dataset-with-respect-to/m-p/478013#M123207</link>
    <description>&lt;P&gt;Without seeing the XSD file I'm&amp;nbsp;not sure if there is any quick and easy way to this. If the structure is clean enough you might be able to build a number of custom formats to display valid/invalid messages. Here's brief example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc format library=work;
value $validsex
'M','F'= 'Valid'
'',' ' = 'Unexpected Missing'
other = 'Unexpected value'
;
run;

data example;
   set sashelp.class;
   if name in ('Alfred' 'Judy') then sex='';
   if name in ('Louise' 'Mary' 'Philip') then sex='A';
run;

proc freq data=example;
  tables sex /missing;
  format sex $validsex.;
run;&lt;/PRE&gt;
&lt;P&gt;However if the value of one variable relies on another&amp;nbsp;&amp;nbsp;then you will have more coding as you would have to take that into account. Which gets into potentially a lot of code depending on complex the relationships may be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jul 2018 19:15:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-07-13T19:15:38Z</dc:date>
    <item>
      <title>Ask the expert / How to validate a SAS dataset with respect to predefined criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ask-the-expert-How-to-validate-a-SAS-dataset-with-respect-to/m-p/477988#M123197</link>
      <description>&lt;P&gt;Hello, I have been ask a task I never done before and to be honest, I don't know how to handle this problem.&lt;/P&gt;&lt;P&gt;Here's the challenge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A SAS Dataset is provided as well as an XSD file where the type (num, string, date) of each variable is defined, the number of values we can tolerate (ex: nb_value= 0 then missing value for this variable could be acceptable, nb_value = 1 then no missing value are acceptable, min and max value that a variable could take and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to use those criteria to validate the sas dataset.&amp;nbsp; If the dataset is validated then we can go through the transformation process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;otherwise, an error report (a SAS dataset containing for all the variables, the observations which deviate from criteria)&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I never did that task before, I am open to any suggestion how could we carry out this task?&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 18:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ask-the-expert-How-to-validate-a-SAS-dataset-with-respect-to/m-p/477988#M123197</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-07-13T18:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Ask the expert / How to validate a SAS dataset with respect to predefined criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ask-the-expert-How-to-validate-a-SAS-dataset-with-respect-to/m-p/478013#M123207</link>
      <description>&lt;P&gt;Without seeing the XSD file I'm&amp;nbsp;not sure if there is any quick and easy way to this. If the structure is clean enough you might be able to build a number of custom formats to display valid/invalid messages. Here's brief example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc format library=work;
value $validsex
'M','F'= 'Valid'
'',' ' = 'Unexpected Missing'
other = 'Unexpected value'
;
run;

data example;
   set sashelp.class;
   if name in ('Alfred' 'Judy') then sex='';
   if name in ('Louise' 'Mary' 'Philip') then sex='A';
run;

proc freq data=example;
  tables sex /missing;
  format sex $validsex.;
run;&lt;/PRE&gt;
&lt;P&gt;However if the value of one variable relies on another&amp;nbsp;&amp;nbsp;then you will have more coding as you would have to take that into account. Which gets into potentially a lot of code depending on complex the relationships may be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 19:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ask-the-expert-How-to-validate-a-SAS-dataset-with-respect-to/m-p/478013#M123207</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-13T19:15:38Z</dc:date>
    </item>
  </channel>
</rss>

