<?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: an easy question about &amp;quot;set by&amp;quot;statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/485021#M125969</link>
    <description>&lt;P&gt;When PROC SORT uses OUT=, it leaves the original data set intact.&amp;nbsp; The sorted version is stored (in this case) in __TEMP.&amp;nbsp; So the SET statement has to read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set __temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can use the BY statement without getting the error.&amp;nbsp; Don't forget the RUN statement at the end of the DATA step.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Aug 2018 06:59:05 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-08-08T06:59:05Z</dc:date>
    <item>
      <title>an easy question about "set by"statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/484983#M125938</link>
      <description>&lt;P&gt;These codes work exactly I wanted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=__temp; 
by age;
run;
data __temp1 ;
set __temp; 
by age ;&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;however,this get only five columns without any rows for the first time run.When I run it for the second time,it returned an error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data __temp2;
set sashelp.class;
by age;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; ERROR: BY variables are not properly sorted on data set SASHELP.CLASS.
 Name=Alfred Sex=M Age=14 Height=69 Weight=112.5 FIRST.Age=1 LAST.Age=1 _ERROR_=1 _N_=1
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: There were 2 observations read from the data set SASHELP.CLASS.
 WARNING: The data set WORK.__TEMP2 may be incomplete.  When this step was stopped there were 0 observations and 5 variables.
 WARNING: Data set WORK.__TEMP2 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;although this is may be easy ,I found little about why and the document did not write anything about this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;someone knows please explain a little! thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 04:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/484983#M125938</guid>
      <dc:creator>Geo-</dc:creator>
      <dc:date>2018-08-08T04:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: an easy question about "set by"statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/484988#M125943</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data __temp2;
set sashelp.class;
by age notsorted;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;age is not sorted in source sashelp.class whereas your __temp is sorted by age as you did using proc sort.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 05:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/484988#M125943</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-08T05:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: an easy question about "set by"statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/485021#M125969</link>
      <description>&lt;P&gt;When PROC SORT uses OUT=, it leaves the original data set intact.&amp;nbsp; The sorted version is stored (in this case) in __TEMP.&amp;nbsp; So the SET statement has to read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;set __temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can use the BY statement without getting the error.&amp;nbsp; Don't forget the RUN statement at the end of the DATA step.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/485021#M125969</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-08T06:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: an easy question about "set by"statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/629096#M185993</link>
      <description>Hello, i think he had the same set__temp ; statement</description>
      <pubDate>Tue, 03 Mar 2020 11:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/an-easy-question-about-quot-set-by-quot-statement/m-p/629096#M185993</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2020-03-03T11:59:03Z</dc:date>
    </item>
  </channel>
</rss>

