<?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: Is there a sort option in PROC EXPORT? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857565#M37828</link>
    <description>&lt;P&gt;There is no sort option in PROC EXPORT. You would need to do the sorting in PROC SORT.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 15:12:55 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-02-07T15:12:55Z</dc:date>
    <item>
      <title>Is there a sort option in PROC EXPORT?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857564#M37827</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a data with var1 and var2, and I wanted the final .csv file to be sorted by var2, my question is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to sort the data in a PROC EXPORT step or the data can only be sorted by a PROC SORT before the PROC EXPORT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it is possible to sort using PROC EXPORT, what's the syntax?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857564#M37827</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2023-02-07T15:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option in PROC EXPORT?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857565#M37828</link>
      <description>&lt;P&gt;There is no sort option in PROC EXPORT. You would need to do the sorting in PROC SORT.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857565#M37828</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-07T15:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a sort option in PROC EXPORT?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857576#M37829</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253026"&gt;@cosmid&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could define a PROC SQL view including an ORDER BY clause and apply PROC EXPORT to this view. Then the sorting will occur &lt;EM&gt;during&lt;/EM&gt; the PROC EXPORT step and without creating a sorted dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set sashelp.class(keep=age weight);
run;

proc sql;
create view have_s as
select * from have
order by weight;
quit;

proc export data=have_s 
outfile='C:\Temp\want.csv' dbms=csv replace;
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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 16:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-sort-option-in-PROC-EXPORT/m-p/857576#M37829</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-02-07T16:01:50Z</dc:date>
    </item>
  </channel>
</rss>

