<?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: Update dataset onto itself.... WARNING in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795822#M255305</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks guys....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*  Only works if the desired changed-to filename does not exist.... */
/*
proc datasets library=sas_1;
change combined_2=combined;
run;
*/


data sas_1.combined;
set sas_1.combined_2;
run;

proc datasets lib=sas_1;
delete combined_2;
delete combined_temp;
run;

quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 12 Feb 2022 07:49:49 GMT</pubDate>
    <dc:creator>NKormanik</dc:creator>
    <dc:date>2022-02-12T07:49:49Z</dc:date>
    <item>
      <title>Update dataset onto itself.... WARNING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795811#M255295</link>
      <description>&lt;P&gt;Please look over the following code, particularly toward the bottom where there is a &lt;FONT color="#800000"&gt;NOTE&lt;/FONT&gt; and &lt;FONT color="#800000"&gt;WARNING&lt;/FONT&gt; message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1    proc summary data=sas_1.combined;
2    var
3    i_50401_Z
4    i_50402_Z
5    i_50403_Z
6    i_50404_Z
7    i_50405_Z
8    i_50408_Z
9    i_50501_Z
10   i_50502_Z
11   i_50503_Z
12   i_50504_Z
13   i_50505_Z
14   i_50508_Z
15   ;
16   output out=sas_1.combined_temp (drop= _:) p80= /autoname;
17   run;

NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 5000 observations read from the data set SAS_1.COMBINED.
NOTE: The data set SAS_1.COMBINED_TEMP has 1 observations and 12 variables.
NOTE: PROCEDURE SUMMARY used (Total process time):
      real time           0.07 seconds
      user cpu time       0.01 seconds
      system cpu time     0.03 seconds
      memory              13816.03k
      OS Memory           30012.00k
      Timestamp           02/11/2022 07:13:37 PM
      Step Count                        1  Switch Count  0


18
19   Proc sql;
20   create table sas_1.combined as
21   select a.*,
22   (a.i_50401_Z &amp;gt;= b.i_50401_Z_P80) as i_50401_Z_top20pct ,
23   (a.i_50402_Z &amp;gt;= b.i_50402_Z_P80) as i_50402_Z_top20pct ,
24   (a.i_50403_Z &amp;gt;= b.i_50403_Z_P80) as i_50403_Z_top20pct ,
25   (a.i_50404_Z &amp;gt;= b.i_50404_Z_P80) as i_50404_Z_top20pct ,
26   (a.i_50405_Z &amp;gt;= b.i_50405_Z_P80) as i_50405_Z_top20pct ,
27   (a.i_50408_Z &amp;gt;= b.i_50408_Z_P80) as i_50408_Z_top20pct ,
28   (a.i_50501_Z &amp;gt;= b.i_50501_Z_P80) as i_50501_Z_top20pct ,
29   (a.i_50502_Z &amp;gt;= b.i_50502_Z_P80) as i_50502_Z_top20pct ,
30   (a.i_50503_Z &amp;gt;= b.i_50503_Z_P80) as i_50503_Z_top20pct ,
31   (a.i_50504_Z &amp;gt;= b.i_50504_Z_P80) as i_50504_Z_top20pct ,
32   (a.i_50505_Z &amp;gt;= b.i_50505_Z_P80) as i_50505_Z_top20pct ,
33   (a.i_50508_Z &amp;gt;= b.i_50508_Z_P80) as i_50508_Z_top20pct
34
35   from sas_1.combined as a,  sas_1.combined_temp as b;
&lt;STRONG&gt;&lt;FONT color="#993300"&gt;NOTE&lt;/FONT&gt;&lt;/STRONG&gt;: The execution of this query involves performing one or more Cartesian product joins that can not be optimized.
&lt;STRONG&gt;&lt;FONT color="#993300"&gt;WARNING&lt;/FONT&gt;&lt;/STRONG&gt;: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem.
NOTE: Table SAS_1.COMBINED created, with 5000 rows and 447 columns.

36
37   quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm creating 'flag' variables, to designate the top 20% of the values for various variables.&amp;nbsp; (Huge thanks to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;for the code.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd prefer to keep the name of the dataset the same.&amp;nbsp; But that means overwriting the initial dataset.&amp;nbsp; SAS gives a WARNING.&amp;nbsp; However, the dataset seems to get updated just fine nonetheless.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you think?&amp;nbsp; Just overlook the WARNING?&amp;nbsp; Or is there a better way of going about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Nicholas Kormanik&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 02:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795811#M255295</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2022-02-12T02:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Update dataset onto itself.... WARNING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795815#M255298</link>
      <description>&lt;P&gt;I am afraid you need to create a new table .&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 03:28:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795815#M255298</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-02-12T03:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Update dataset onto itself.... WARNING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795819#M255302</link>
      <description>&lt;P&gt;Do not overwrite a dataset in a single step, a slight miscue will otherwise destroy it.&lt;/P&gt;
&lt;P&gt;For simplicity of coding, I would use a DATA step and arrays.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Feb 2022 06:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795819#M255302</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-12T06:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Update dataset onto itself.... WARNING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795822#M255305</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks guys....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*  Only works if the desired changed-to filename does not exist.... */
/*
proc datasets library=sas_1;
change combined_2=combined;
run;
*/


data sas_1.combined;
set sas_1.combined_2;
run;

proc datasets lib=sas_1;
delete combined_2;
delete combined_temp;
run;

quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Feb 2022 07:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-dataset-onto-itself-WARNING/m-p/795822#M255305</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2022-02-12T07:49:49Z</dc:date>
    </item>
  </channel>
</rss>

