<?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 ERROR: BY variables are not properly sorted on data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698056#M25475</link>
    <description>&lt;P&gt;I am trying to combine 5 different data sets, and on the 5th one, it is saying I have an error that my BY variables are not sorted properly, even though I included PROC SORTS in the same way for each data set:&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 = HypImpt.UTAH_VITALS_2010 OUT= UTAH_VITALS_2010; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2011 OUT= UTAH_VITALS_2011; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2012 OUT= UTAH_VITALS_2012; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2013 OUT= UTAH_VITALS_2013; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2014 OUT= UTAH_VITALS_2014; 
	BY SSN ApptDate; 
	RUN; 


DATA	WORK.Vitals_UT;

	SET	HypImpt.UTAH_VITALS_2010
		HypImpt.UTAH_VITALS_2011
		HypImpt.UTAH_VITALS_2012
		HypImpt.UTAH_VITALS_2013
		HypImpt.UTAH_VITALS_2014;
    BY  SSN ApptDate; 
	
	RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error it gives me is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: BY variables are not properly sorted on data set HYPIMPT.UTAH_VITALS_2014.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Nov 2020 01:44:21 GMT</pubDate>
    <dc:creator>aelatova</dc:creator>
    <dc:date>2020-11-11T01:44:21Z</dc:date>
    <item>
      <title>ERROR: BY variables are not properly sorted on data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698056#M25475</link>
      <description>&lt;P&gt;I am trying to combine 5 different data sets, and on the 5th one, it is saying I have an error that my BY variables are not sorted properly, even though I included PROC SORTS in the same way for each data set:&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 = HypImpt.UTAH_VITALS_2010 OUT= UTAH_VITALS_2010; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2011 OUT= UTAH_VITALS_2011; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2012 OUT= UTAH_VITALS_2012; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2013 OUT= UTAH_VITALS_2013; 
	BY SSN ApptDate; 
	RUN; 
	
PROC SORT DATA = HypImpt.UTAH_VITALS_2014 OUT= UTAH_VITALS_2014; 
	BY SSN ApptDate; 
	RUN; 


DATA	WORK.Vitals_UT;

	SET	HypImpt.UTAH_VITALS_2010
		HypImpt.UTAH_VITALS_2011
		HypImpt.UTAH_VITALS_2012
		HypImpt.UTAH_VITALS_2013
		HypImpt.UTAH_VITALS_2014;
    BY  SSN ApptDate; 
	
	RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error it gives me is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: BY variables are not properly sorted on data set HYPIMPT.UTAH_VITALS_2014.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 01:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698056#M25475</guid>
      <dc:creator>aelatova</dc:creator>
      <dc:date>2020-11-11T01:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: BY variables are not properly sorted on data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698058#M25476</link>
      <description>The sorted data set is the OUT= data set.&lt;BR /&gt;&lt;BR /&gt;So UTAH_VITALS_2014 is properly sorted, while HypImpt.UTAH_VITALS_2014 is not properly sorted.</description>
      <pubDate>Wed, 11 Nov 2020 01:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698058#M25476</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-11T01:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: BY variables are not properly sorted on data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698174#M25481</link>
      <description>&lt;P&gt;Hence, even if it's not required, it's good practive to wtite out&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;work.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in all saswork table references.&lt;/P&gt;
&lt;P&gt;By doing that, it's easier to spot these kind of logical errors in your code.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 15:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698174#M25481</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2020-11-11T15:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: BY variables are not properly sorted on data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698178#M25482</link>
      <description>&lt;P&gt;You can get this much easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all / view=all;
set
  HypImpt.UTAH_VITALS_2010
  HypImpt.UTAH_VITALS_2011
  HypImpt.UTAH_VITALS_2012
  HypImpt.UTAH_VITALS_2013
  HypImpt.UTAH_VITALS_2014
;
run;

proc sort
  data=all
  out=Vitals_UT
;
by ssn apptdate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Nov 2020 16:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/ERROR-BY-variables-are-not-properly-sorted-on-data-set/m-p/698178#M25482</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-11T16:07:48Z</dc:date>
    </item>
  </channel>
</rss>

