<?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: Efficient way to verify a file structure and type in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162360#M31504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc dataset/contents for retrieving the information in a datasets and a compare with a predefined&amp;nbsp; datasets with what you expected.&lt;BR /&gt;If you need retrieve that from SAS metadata-server some interfaces are existing.&lt;BR /&gt;It is like working with research-data now it is metadata (metadata is describing the data).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 May 2014 16:07:54 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2014-05-16T16:07:54Z</dc:date>
    <item>
      <title>Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162359#M31503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking for recommendations on a quick way to verify that a file has the variables and appropriate variable types (character/numeric) that I expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 15:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162359#M31503</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-16T15:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162360#M31504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc dataset/contents for retrieving the information in a datasets and a compare with a predefined&amp;nbsp; datasets with what you expected.&lt;BR /&gt;If you need retrieve that from SAS metadata-server some interfaces are existing.&lt;BR /&gt;It is like working with research-data now it is metadata (metadata is describing the data).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162360#M31504</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-05-16T16:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162361#M31505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I do usually&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=have out=want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I can explore dataset want to see data structures/variable types lengths etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162361#M31505</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-16T16:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162362#M31506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you capture the output from the proc compare to verify file structure? I want this to run automatically with no intervention from me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if the variable is missing or a variable is numeric when it should be character I want to print an error to that effect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162362#M31506</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-16T16:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162363#M31507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure if this answers your questions. Please see below to compare two datasets' structures. There are two datasets (have before processing) and (want after processing).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=have out=one;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=want out=two;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;set one;&lt;/P&gt;&lt;P&gt;flag=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data two;&lt;/P&gt;&lt;P&gt;set two;&lt;/P&gt;&lt;P&gt;flag=2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table all as&lt;/P&gt;&lt;P&gt;select * from one&lt;/P&gt;&lt;P&gt;union all&lt;/P&gt;&lt;P&gt;select * from two;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc tabulate data=all;&lt;/P&gt;&lt;P&gt;class name type flag;&lt;/P&gt;&lt;P&gt;table name*type,flag;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162363#M31507</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-05-16T16:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162364#M31508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd still have to read the tabulate output &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up using a SQL Full Join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the name was missing in one file then I print an error to the log using a data _null_ step.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162364#M31508</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-16T16:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162365#M31509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make a shell dataset&amp;nbsp; that has the variables you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then run proc contents on your shell and what you have and compare the output. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pseudo code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=shell out=__list1 (keep=name);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=have out=__list2 (keep=name);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc compare base=__list1 compare=__list2 error;&lt;/P&gt;&lt;P&gt;&amp;nbsp; id name ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That makes it pretty easy to control what you want to consider a difference.&amp;nbsp; So you can decide to ignore case in names, or you can add type and label and other attributes to the output dataset from proc contents, or whatever.&amp;nbsp; With the&amp;nbsp; error option, PROC COMPARE will throw an error if it finds any difference, which is a great option I only discovered in the past couple years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of proc contents you could use dictionary tables, but often proc contents turns out to be faster if you have a lot of libraries defined and dictionary.columns is huge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 16:57:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162365#M31509</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2014-05-16T16:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162366#M31510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;little to be added. All approaches being mentioned except the SAS datastep merge for comparing&lt;/P&gt;&lt;P&gt;You have now:&amp;nbsp; 2 options to get the info, 3 for comparing. &lt;BR /&gt;choose to your additional requirements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 17:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162366#M31510</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-05-16T17:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Efficient way to verify a file structure and type</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162367#M31511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Quentin, the error is what I was looking for. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 May 2014 17:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Efficient-way-to-verify-a-file-structure-and-type/m-p/162367#M31511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-05-16T17:34:17Z</dc:date>
    </item>
  </channel>
</rss>

