<?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 sort in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803498#M316382</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I am tempted to write as follows, ie dropping duplicate and variable "date" before sorting, would the result be the same?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why don't you try?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SQL you've posted only requires a single semicolon at the end.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table book_2 as
    Select distinct post, bookcart, cake, lemon
    from cch
    order by post_to_acct
    ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Mar 2022 04:26:47 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2022-03-23T04:26:47Z</dc:date>
    <item>
      <title>Order of execution within proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803497#M316381</link>
      <description>&lt;P&gt;Hi I want to know the sequence of how sas process the code...&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sort data=cch (drop=date) out=book nodupkey;
by post_to_acct;
run;&lt;/PRE&gt;
&lt;P&gt;am I right to think the following sequence from the above code...&lt;/P&gt;
&lt;P&gt;1. drop date&lt;/P&gt;
&lt;P&gt;2. sort by post_to_acct;&lt;/P&gt;
&lt;P&gt;3. drop duplicate&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. output to book&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am tempted to write as follows, ie dropping duplicate and variable "date" before sorting, would the result be the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Select distinct post bookcart cake lemon;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;from cch;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;order by post_to_acct;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 13:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803497#M316381</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-23T13:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803498#M316382</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I am tempted to write as follows, ie dropping duplicate and variable "date" before sorting, would the result be the same?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why don't you try?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SQL you've posted only requires a single semicolon at the end.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table book_2 as
    Select distinct post, bookcart, cake, lemon
    from cch
    order by post_to_acct
    ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2022 04:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803498#M316382</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-03-23T04:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc sort</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803507#M316386</link>
      <description>&lt;P&gt;The SQL procedure is an "interactive" procedure; all statements are executed immediately (no RUN is needed), and it must be terminated with a QUIT.&lt;/P&gt;
&lt;P&gt;The SELECT is a single statement which also contains the FROM and ORDER BY clauses, so remove the in-between semicolons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While DROP= removes the explicitly named variables&amp;nbsp;&lt;EM&gt;and keeps all others&lt;/EM&gt;, SELECT keeps the named variables&amp;nbsp;&lt;EM&gt;and drops all others&lt;/EM&gt;, so the behavior is different depending on the "other" variables not mentioned in the dataset option/SQL statement.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 06:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Order-of-execution-within-proc-sort/m-p/803507#M316386</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-23T06:44:04Z</dc:date>
    </item>
  </channel>
</rss>

