<?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: Can I truncate a dataset preserving integrity constraints? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133793#M27178</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the code below. As &lt;A __default_attr="119192" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; mentioned all the integrity constraints are copied, but not the audit information.&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;obs&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;datasets&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;lib&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=work;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;append&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=_class &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;exchange&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; class = _class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;delete&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; _class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;quit&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;obs&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=max;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Nov 2013 10:32:57 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2013-11-07T10:32:57Z</dc:date>
    <item>
      <title>Can I truncate a dataset preserving integrity constraints?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133791#M27176</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;If I create a permanent dataset containing integrity constraints, but need to occasionally rebuild it from scratch, is it possible to truncate the dataset and preserve integrity constraints?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that an OUT2= dataset may allow me to kludge the recreation of the IC's; what I want to know is if I can truncate the dataset and maintain the ICs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;datasets&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;lib&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=work &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;nolist&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;audit&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;initiate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: red; background: white;"&gt;user_var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; reason_code $&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;20&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;modify&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; primary_key = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;primary&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;key&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; (name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; val_gender = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;check&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(where=(sex in (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'M'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'F'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;message&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"Valid values for variable GENDER are either 'M' or 'F'."&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;msgtype&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=user;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; val_age = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;check&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(where=(age &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;10&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; and age &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;20&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;message&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"An invalid AGE has been provided."&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;msgtype&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=user;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* none of these work... ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;modify&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* works but would perform horribly on a large dataset ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;modify&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;remove&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;sql&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: red; background: white;"&gt;truncate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; table class;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* invalid SQL ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;sql&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class (obs=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* blind hacking at this point... ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;append&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=class(obs=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=class(obs=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 05:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133791#M27176</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2013-11-07T05:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I truncate a dataset preserving integrity constraints?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133792#M27177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Proc append with a non-existing base-table will give a copy all attributes of the data= table, including constraints.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=class_trunc data=class(obs=0);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets lib=work;&lt;/P&gt;&lt;P&gt;...statements to drop original table and rename the truncated copy to original name...&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 08:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133792#M27177</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-11-07T08:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can I truncate a dataset preserving integrity constraints?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133793#M27178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the code below. As &lt;A __default_attr="119192" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; mentioned all the integrity constraints are copied, but not the audit information.&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;obs&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;datasets&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;lib&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=work;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;append&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=_class &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;exchange&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; class = _class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;delete&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; _class;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;quit&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;obs&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=max;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 10:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133793#M27178</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2013-11-07T10:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can I truncate a dataset preserving integrity constraints?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133794#M27179</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;Another issue related to the original question...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the below code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ls&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=max;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* start with a "clean slate" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;datasets&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;lib&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=work &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;nowarn&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;nolist&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;kill&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* create sample data (with write access) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* for added safety, we're also specifying an alter password ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;alter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=password);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* use proc datasets to create integrity constraints and control auditing ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;datasets&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;lib&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=work &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;nolist&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* turn on auditing ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;audit&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class (alter=password);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;initiate&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* a user-specified user variable in the audit dataset ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: red; background: white;"&gt;user_var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; reason_code $&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;30&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* create integrity constraints ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;modify&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; class (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;alter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=password);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; primary_key = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;primary&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;key&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; (name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; val_gender = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;check&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(where=(sex in (&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'M'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'F'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;message&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"Valid values for variable GENDER are either 'M' or 'F'."&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;msgtype&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=user;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;ic&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; val_age = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;check&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(where=(age &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;10&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; and age &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;20&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;message&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"An invalid AGE has been provided."&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;msgtype&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=user;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* create transaction dataset ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; source;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; reason_code $&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;30&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; reason_code=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"Adding new data"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* append 5 observations ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;append&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=source (obs=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;5&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* append all observations.&amp;nbsp; the first 5 should be rejected by the integrity constraints ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;append&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;base&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=source;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* note that class has logically deleted observations. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* pay close attention to the observation numbers (i.e. obs 6-10) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;print&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would have been nice if SAS could have detected the IC violation before attempting to add the record to the target dataset, rather than adding it and then logically deleting the added record after the fact.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Is there a way to remove the logically deleted records and preserve the IC's and auditing?&lt;/P&gt;&lt;P&gt;2) In a "large" dataset with potentially thousands or millions of logically deleted observations, would that contribute to "file bloating" and reduced performance than if the logically deleted records were not present?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 06:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133794#M27179</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2013-11-22T06:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can I truncate a dataset preserving integrity constraints?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133795#M27180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to remove that empty space from the table I think you need to recreate and the audit would be lost. Hiwever, you could extract the audit as a table before losing it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 11:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-truncate-a-dataset-preserving-integrity-constraints/m-p/133795#M27180</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-11-22T11:19:26Z</dc:date>
    </item>
  </channel>
</rss>

