<?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: Check for non-existing data element in a file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297994#M62626</link>
    <description>&lt;P&gt;Define "files". &amp;nbsp;Do you mean text files, excel files, SAS datafiles etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I find this to be a defect in the import process. &amp;nbsp;A clean process would be:&lt;/P&gt;
&lt;P&gt;1) Define Data Transfer Specifications document - this is the basis for everything next and should be agreed and approved by both parties.&lt;/P&gt;
&lt;P&gt;2) Create an import progra/check program based on that document&lt;/P&gt;
&lt;P&gt;3) Test the process with test data&lt;/P&gt;
&lt;P&gt;4) After pass, the document is live and transfer can occur.&lt;/P&gt;
&lt;P&gt;5) At each delivery data is checked/imported/validated etc. per the document. &amp;nbsp;Any failures go directly back to the supplier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you don't have this agreement, hence you really don't have much control over what is happening. &amp;nbsp;I mean what if they decide to include GREVERB, but not TEST1, or maybe they call all the variables XYZ1-XYZ10, or they just write the information on the back of a cornflakes box, scan that in, and send it someone else? &amp;nbsp;A bit of an extreme example, but the point is the process is everything, and should be thoroughly documented, tested, replicable before and at each time.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 12:32:55 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-09-13T12:32:55Z</dc:date>
    <item>
      <title>Check for non-existing data element in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297858#M62586</link>
      <description>&lt;P&gt;I have several files with the same data elements.&lt;/P&gt;
&lt;P&gt;However, in some of these files a prior programmer, omitted some data elements.&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp;&amp;nbsp; Id, Name, Test1, Test2, Test3, GREVERB, GREVERB2, GMATVERB&lt;/P&gt;
&lt;P&gt;some files are missing: &amp;nbsp;GREVERB, GREVERB2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there anyway&amp;nbsp;to test that these data elements are missing?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 20:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297858#M62586</guid>
      <dc:creator>IsoTropic</dc:creator>
      <dc:date>2016-09-12T20:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing data element in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297863#M62590</link>
      <description>&lt;P&gt;Take a&amp;nbsp;ook at sashelp.vcolumn which lists all columns in all tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can run a proc freq by column name to see variable frequency. And can query the table to filter the for tables that are missing the variables of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 21:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297863#M62590</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-12T21:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing data element in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297994#M62626</link>
      <description>&lt;P&gt;Define "files". &amp;nbsp;Do you mean text files, excel files, SAS datafiles etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I find this to be a defect in the import process. &amp;nbsp;A clean process would be:&lt;/P&gt;
&lt;P&gt;1) Define Data Transfer Specifications document - this is the basis for everything next and should be agreed and approved by both parties.&lt;/P&gt;
&lt;P&gt;2) Create an import progra/check program based on that document&lt;/P&gt;
&lt;P&gt;3) Test the process with test data&lt;/P&gt;
&lt;P&gt;4) After pass, the document is live and transfer can occur.&lt;/P&gt;
&lt;P&gt;5) At each delivery data is checked/imported/validated etc. per the document. &amp;nbsp;Any failures go directly back to the supplier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you don't have this agreement, hence you really don't have much control over what is happening. &amp;nbsp;I mean what if they decide to include GREVERB, but not TEST1, or maybe they call all the variables XYZ1-XYZ10, or they just write the information on the back of a cornflakes box, scan that in, and send it someone else? &amp;nbsp;A bit of an extreme example, but the point is the process is everything, and should be thoroughly documented, tested, replicable before and at each time.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 12:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/297994#M62626</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-09-13T12:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing data element in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/298070#M62649</link>
      <description>&lt;P&gt;Here is an approach using a control data set with the information, library, dataset and variable name of interest, and searching dictionary.columns (or sashelp.vcolumn) to create a data set with the information and an added variable "found" which will have a value of 1 when found (exists) or 0 when it doesn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The example has the desired information in uppercase for consistency. The dictionary table will have the Library and dataset name in upper case as well. Variable names seem to be a bit more flexible as to case so I force an uppercase comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data control;
   informat libname $8. setname $32. varname $32.;
   input libname setname varname;
datalines;
SASHELP CLASS AGE
SASHELP CLASS WEIGHT
SASHELP CLASS XYZZY
;
RUN; 

PROC SQL;
   create table foundit as
   select control.libname, control.setname, control.varname,
          (control.varname=upcase(b.name)) as found
   from control left join dictionary.columns as b on
        control.libname=b.libname and control.setname=b.memname
        and control.varname=upcase(b.name)
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Sep 2016 15:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/298070#M62649</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-13T15:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Check for non-existing data element in a file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/298092#M62654</link>
      <description>I actually know what files are missing the values.&lt;BR /&gt;If I did not this would work well. &lt;BR /&gt;I will just need to recreate the files with the correct variables.</description>
      <pubDate>Tue, 13 Sep 2016 16:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-for-non-existing-data-element-in-a-file/m-p/298092#M62654</guid>
      <dc:creator>IsoTropic</dc:creator>
      <dc:date>2016-09-13T16:20:15Z</dc:date>
    </item>
  </channel>
</rss>

