<?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 Keep statement never works in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531356#M145414</link>
    <description>&lt;P&gt;I would be very surprised if the KEEP statement is not honored.&amp;nbsp; Are you sure your PROC SORT step ran?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are really concerned then move the KEEP= dataset option to the input dataset instead of the output dataset.&amp;nbsp; Why bother keeping the other variables around during the sorting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you are keeping more variables than you are using in the BY statement.&amp;nbsp; So SAS will just keep the values of the extra variables from the one observation in selects for that BY group.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 13:04:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-01-30T13:04:40Z</dc:date>
    <item>
      <title>PROC SORT Keep statement never works</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531339#M145409</link>
      <description>&lt;P&gt;Hi. I am using PROC SORT Nodupkey to remove duplicate data. The thing is, no matter how i put (KEEP=) statement, the output column is only displaying as per my BY statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=ppu_sum2
out=ppu_sum(keep=substationname substationcode voltagetype equipmentname feedertype substationtype datetime) nodupkey;
by substationname substationcode  substationtype datetime;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i make it output according to the out(KEEP=) statement?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 11:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531339#M145409</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2019-01-30T11:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SORT Keep statement never works</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531350#M145412</link>
      <description>&lt;P&gt;do you mean the order of the columns from left to right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
retain substationname substationcode voltagetype equipmentname feedertype substationtype datetime;
set ppusum;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 12:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531350#M145412</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-30T12:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SORT Keep statement never works</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531356#M145414</link>
      <description>&lt;P&gt;I would be very surprised if the KEEP statement is not honored.&amp;nbsp; Are you sure your PROC SORT step ran?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are really concerned then move the KEEP= dataset option to the input dataset instead of the output dataset.&amp;nbsp; Why bother keeping the other variables around during the sorting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you are keeping more variables than you are using in the BY statement.&amp;nbsp; So SAS will just keep the values of the extra variables from the one observation in selects for that BY group.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 13:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531356#M145414</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-30T13:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SORT Keep statement never works</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531384#M145424</link>
      <description>&lt;P&gt;Maxim 2: Read the Log&lt;/P&gt;
&lt;P&gt;If that does not provide a clue, post it here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that ppu_sum2 contains all the variables you have in the keep= option?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 15:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531384#M145424</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-30T15:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SORT Keep statement never works</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531389#M145427</link>
      <description>&lt;P&gt;"Never&amp;nbsp;works" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 15:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SORT-Keep-statement-never-works/m-p/531389#M145427</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-30T15:17:25Z</dc:date>
    </item>
  </channel>
</rss>

