<?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: Proc SQL &amp;gt; Delete from (Where) &amp;gt; Dataset attributes. (ATTRN) in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208539#M15628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Tom, I'm an idiot for missing that! I read the ATTRN page (i think!) :smileycool:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jul 2015 13:13:31 GMT</pubDate>
    <dc:creator>JoeMadden</dc:creator>
    <dc:date>2015-07-22T13:13:31Z</dc:date>
    <item>
      <title>Proc SQL &gt; Delete from (Where) &gt; Dataset attributes. (ATTRN)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208537#M15626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Working with a SAS dataset, I carry out a delete using "proc sql delete from where" however, this procedure doesn't appear to update the attribute (obs count) of the dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code below as an example;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/****************************************************/&lt;BR /&gt;/* Dummy data - 7 Obs&lt;BR /&gt;/****************************************************/&lt;BR /&gt;data work.chgdata;&lt;BR /&gt;&amp;nbsp; input account&amp;nbsp; 12. charge;&lt;BR /&gt;&amp;nbsp; format account 14. charge&amp;nbsp; dollar7.;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;345620135872 10&lt;BR /&gt;345620134522 7&lt;BR /&gt;345620123456 12&lt;BR /&gt;382957492811 3&lt;BR /&gt;345620134663 8&lt;BR /&gt;345620131455 6&lt;BR /&gt;345620104732 9&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* NOTE: The data set WORK.CHGDATA has 7 observations and 2 variables. */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/****************************************************/&lt;BR /&gt;/* Capture dataset attribute (Number of Observations)&lt;BR /&gt;/****************************************************/&lt;BR /&gt;%let dsid=%sysfunc(open(work.chgdata));&lt;BR /&gt;%let obs=%sysfunc(attrn(&amp;amp;dsid,nobs));&lt;BR /&gt;%put %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;%put &amp;amp;obs;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* SYMBOLGEN:&amp;nbsp; Macro variable OBS resolves to 7 */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Delete from work.chgdata&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where charge in (6,9);&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* NOTE: 2 rows were deleted from WORK.CHGDATA. */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dsid=%sysfunc(open(work.chgdata));&lt;BR /&gt;%let obs=%sysfunc(attrn(&amp;amp;dsid,nobs));&lt;BR /&gt;%put %sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;%put &amp;amp;obs;&lt;/P&gt;&lt;P&gt;/* SYMBOLGEN:&amp;nbsp; Macro variable OBS resolves to 7 */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Count(*) into :trueobs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; From work.chgdata;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;%put &amp;amp;trueobs;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;/* SYMBOLGEN: Macro variable TRUEOBS resolves to 5 */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) is this a known bug / fault / outcome?&lt;/P&gt;&lt;P&gt;b) is there anyway, using the Proc SQL to force the update of the dataset attributes so that I can use the attrn value of the dataset later on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 11:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208537#M15626</guid>
      <dc:creator>JoeMadden</dc:creator>
      <dc:date>2015-07-22T11:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL &gt; Delete from (Where) &gt; Dataset attributes. (ATTRN)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208538#M15627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are looking at the wrong field. NOBS is how many observations are physically in the table. You want to look at NLOBS which is how many observations are logically in the table. The difference is NDEL, the number of deleted observations.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212040.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212040.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="strongMono" style="font-family: monospace, 'courier new', courier, fixed; font-weight: bold;"&gt;NDEL&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841607" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of observations in the data set that are marked for deletion.&lt;/P&gt;&lt;P&gt;&lt;A name="a001079421" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongMono" style="font-family: monospace, 'courier new', courier, fixed; font-weight: bold;"&gt;NEXTGEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a001079422" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the next generation number to generate.&lt;/P&gt;&lt;P&gt;&lt;A name="a000841608" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongMono" style="font-family: monospace, 'courier new', courier, fixed; font-weight: bold;"&gt;NLOBS&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841609" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of logical observations (the observations that are not marked for deletion). An active WHERE clause does not affect this number.&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="largeSpace"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR align="left" style="font-family: inherit;" valign="top"&gt;&lt;TD&gt;&lt;A name="a000841610" style="font-family: inherit;"&gt;&lt;/A&gt;-1&lt;/TD&gt;&lt;TD align="left"&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841611" style="font-family: inherit;"&gt;&lt;/A&gt;the number of observations is not available.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;A name="a001079424" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongMono" style="font-family: monospace, 'courier new', courier, fixed; font-weight: bold;"&gt;NLOBSF&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a001079425" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of logical observations (the observations that are not marked for deletion) by forcing each observation to be read and by taking the FIRSTOBS system option, the OBS system option, and the WHERE clauses into account.&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Tip:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a001079426" style="font-family: inherit;"&gt;&lt;/A&gt;Passing NLOBSF to ATTRN requires the engine to read every observation from the data set that matches the WHERE clause. Based on the file type and file size, reading these observations can be a time-consuming process.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;A name="a000841612" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongMono" style="font-family: monospace, 'courier new', courier, fixed; font-weight: bold;"&gt;NOBS&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841613" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of physical observations (including the observations that are marked for deletion). An active WHERE clause does not affect this number.&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="largeSpace"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR align="left" style="font-family: inherit;" valign="top"&gt;&lt;TD&gt;&lt;A name="a000841614" style="font-family: inherit;"&gt;&lt;/A&gt;-1&lt;/TD&gt;&lt;TD align="left"&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841615" style="font-family: inherit;"&gt;&lt;/A&gt;the number of observations is not available.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208538#M15627</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-22T13:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL &gt; Delete from (Where) &gt; Dataset attributes. (ATTRN)</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208539#M15628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Tom, I'm an idiot for missing that! I read the ATTRN page (i think!) :smileycool:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 13:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Proc-SQL-gt-Delete-from-Where-gt-Dataset-attributes-ATTRN/m-p/208539#M15628</guid>
      <dc:creator>JoeMadden</dc:creator>
      <dc:date>2015-07-22T13:13:31Z</dc:date>
    </item>
  </channel>
</rss>

