<?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: How to validate attributes of a SAS dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523471#M142216</link>
    <description>&lt;P&gt;A dataset does not change attributes out of the blue, there must be code that does that; fix this code, and you won't have to send any notifications. In particular,&amp;nbsp;&lt;STRONG&gt;NEVER&lt;/STRONG&gt; use proc import in production code.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Dec 2018 15:53:26 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-12-25T15:53:26Z</dc:date>
    <item>
      <title>How to validate attributes of a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523470#M142215</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset test and in this dataset I have columns like acctn, cust_name, gender, address curr_date. I want to validate all the attributes of this datasets such as account number should always remain numeric and meta data should not change for all the columns. and I want to send an email to the user if the any attribute change for any column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;attributes ie. type of column, length, format, informat, label, all kind.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA Test;&lt;/P&gt;&lt;P&gt;infile datalines;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;12345 ram&amp;nbsp; &amp;nbsp; M POST OFFICE 2013 12/01/2018&lt;/P&gt;&lt;P&gt;43215 sham F POST OFFICE 2014&amp;nbsp; 12/02/2018&lt;/P&gt;&lt;P&gt;45678 geeta M POST OFFICE 2015 12/03/2018&lt;/P&gt;&lt;P&gt;45677 **bleep**a F POST OFFICE 2016&amp;nbsp; &amp;nbsp;12/04/2018&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 15:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523470#M142215</guid>
      <dc:creator>abhityagi</dc:creator>
      <dc:date>2018-12-25T15:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate attributes of a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523471#M142216</link>
      <description>&lt;P&gt;A dataset does not change attributes out of the blue, there must be code that does that; fix this code, and you won't have to send any notifications. In particular,&amp;nbsp;&lt;STRONG&gt;NEVER&lt;/STRONG&gt; use proc import in production code.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 15:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523471#M142216</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-25T15:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate attributes of a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523499#M142226</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ok. So what is your question for us to answer?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would keep the old data and you can access the formats/types/lengths from SASHELP.VCOLUMN or Dictionary.column and then compare them using your own routine or PROC COMPARE. Then if there's a difference, trigger the email. This is a well documented issue with lots of examples online so there should be a lot out there to get you started.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Send emails:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsglobal&amp;amp;docsetTarget=n0ig2krarrz6vtn1aw9zzvtez4qo.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1rxu4polvqoy3n13t1ado2vfcyd" target="_blank"&gt;https://documentation.sas.com/?docsetId=lestmtsglobal&amp;amp;docsetTarget=n0ig2krarrz6vtn1aw9zzvtez4qo.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n1rxu4polvqoy3n13t1ado2vfcyd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC COMPARE:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0c1y14wyd3u7yn1dmfcpaejllsn.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0c1y14wyd3u7yn1dmfcpaejllsn.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138563"&gt;@abhityagi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset test and in this dataset I have columns like acctn, cust_name, gender, address curr_date. I want to validate all the attributes of this datasets such as account number should always remain numeric and meta data should not change for all the columns. and I want to send an email to the user if the any attribute change for any column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;attributes ie. type of column, length, format, informat, label, all kind.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA Test;&lt;/P&gt;
&lt;P&gt;infile datalines;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;12345 ram&amp;nbsp; &amp;nbsp; M POST OFFICE 2013 12/01/2018&lt;/P&gt;
&lt;P&gt;43215 sham F POST OFFICE 2014&amp;nbsp; 12/02/2018&lt;/P&gt;
&lt;P&gt;45678 geeta M POST OFFICE 2015 12/03/2018&lt;/P&gt;
&lt;P&gt;45677 **bleep**a F POST OFFICE 2016&amp;nbsp; &amp;nbsp;12/04/2018&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 19:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523499#M142226</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-25T19:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate attributes of a SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523504#M142229</link>
      <description>&lt;P&gt;You could try something as below, here I chose the sashelp.class dataset and wanted to check its variable type whether it is character or numeric, if the attribute of the variable is against my expectation then I used the if then condition to send an email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we need to do at the bigger scale for all the variables you want to test. but hope this code will help you somewhat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;
data _null_;
set sashelp.class;
call symput('typ',vtype(name));
run;
%put &amp;amp;typ;
%if &amp;amp;typ ne C %then %do;
filename x email to='xxxx@gmail.com';
data _null_;
file x;
put 'Hi';
run;
%end;
%mend;
%test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Dec 2018 20:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-validate-attributes-of-a-SAS-dataset/m-p/523504#M142229</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-12-25T20:30:05Z</dc:date>
    </item>
  </channel>
</rss>

