<?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: Data Step/PROC SQL comparison in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84042#M18138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paige,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You get the message because PROC SQL may try to do the merge on the backend server.&amp;nbsp;&amp;nbsp; If PROC SQL is running against SQL/Server or Oracle, for example, it will try to create sql commands native to that server and pass them over for more efficient processing.&amp;nbsp; You then run the risk of the server corrupting the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all the data are SAS datasets, then the message is not very useful as both the DATA step and PROC SQL create a new temporary result data set with merged data and you are only at risk for losing the data during the instant that it is renaming the files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 May 2013 13:31:29 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2013-05-23T13:31:29Z</dc:date>
    <item>
      <title>Data Step/PROC SQL comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84041#M18137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I merge two data sets using a SAS data step, SAS allows me to name the merged file with the same name as on of the original data sets. I have never had a problem doing this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge a b;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, a and b are merged to form a new dataset a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try doing this in PROC SQL, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table a as select a.*,b.height from a left join b on a.id=b.id;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get a warning in the log, and I don't really understand the warning, or what risks I am taking by doing things this way. The warning in the LOG says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, what are the risks of doing this via PROC SQL? Or should I just adopt of a policy of not doing this in PROC SQL?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 12:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84041#M18137</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-23T12:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step/PROC SQL comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84042#M18138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paige,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You get the message because PROC SQL may try to do the merge on the backend server.&amp;nbsp;&amp;nbsp; If PROC SQL is running against SQL/Server or Oracle, for example, it will try to create sql commands native to that server and pass them over for more efficient processing.&amp;nbsp; You then run the risk of the server corrupting the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all the data are SAS datasets, then the message is not very useful as both the DATA step and PROC SQL create a new temporary result data set with merged data and you are only at risk for losing the data during the instant that it is renaming the files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 13:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84042#M18138</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-05-23T13:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step/PROC SQL comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84043#M18139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, thanks Doc, that makes sense and it eliminates one of my worries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 13:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84043#M18139</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-05-23T13:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Data Step/PROC SQL comparison</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84044#M18140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paige,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Doc@Duke mentioned the message is not very useful as both the DATA step and PROC SQL create a new temporary result data set with merged data and could lose data during the instant that it is renaming the files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One other thing to take note on, somewhat related, is that a PROC SQL and DATA step merge produce different results if two data sets/tables produce a many-to-many relationship (i.e. many records from one data set/table can merge to many records from the other).&amp;nbsp; That's just because a PROC SQL creates what's called a Cartisan product or every combination of record(s) to record(s) matches between the two data sets/tables.&amp;nbsp; A DATA step merge sequentially matches one record from one data set to the other without looking back (once it matches, it moves on to the next record).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully that makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 14:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Step-PROC-SQL-comparison/m-p/84044#M18140</guid>
      <dc:creator>jmstampe</dc:creator>
      <dc:date>2013-05-23T14:10:00Z</dc:date>
    </item>
  </channel>
</rss>

