<?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: How to sort variables in alphabetical order as Output data in SAS EG? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388375#M25037</link>
    <description>&lt;P&gt;A quick way by retrieving the column names from dictionary.columns and using call execute:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inlib=sashelp;
%let inset=class;
%let outlib=work;
%let outset=class;

proc sql;
create table vars as
select name
from dictionary.columns
where libname = upcase("&amp;amp;inlib.") and memname = upcase("&amp;amp;inset.")
order by name;
quit;

data _null_;
set vars end=done;
if _n_ = 1 then call execute("data &amp;amp;outlib..&amp;amp;outset.; format ");
call execute(name !! ' ');
if done then call execute("; set &amp;amp;inlib..&amp;amp;inset.; run;");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can easily wrap that into a macro with the four macrovars as macro parameters.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2017 06:33:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-16T06:33:17Z</dc:date>
    <item>
      <title>How to sort variables in alphabetical order as Output data in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388213#M25020</link>
      <description>&lt;P&gt;I have a table which the variables are in specific order as Output data, how can I sort it so they are presented in alphabetical order?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.DATA5;&lt;BR /&gt;set WORK.DATA4;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 16:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388213#M25020</guid>
      <dc:creator>KubiK888</dc:creator>
      <dc:date>2017-08-15T16:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort variables in alphabetical order as Output data in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388221#M25021</link>
      <description>&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/696.html" target="_blank"&gt;http://support.sas.com/kb/24/696.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 17:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388221#M25021</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-08-15T17:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort variables in alphabetical order as Output data in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388229#M25022</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;&amp;nbsp;just a quick note that I edited your link to remove an extra space at the end.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 17:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388229#M25022</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-15T17:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort variables in alphabetical order as Output data in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388375#M25037</link>
      <description>&lt;P&gt;A quick way by retrieving the column names from dictionary.columns and using call execute:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inlib=sashelp;
%let inset=class;
%let outlib=work;
%let outset=class;

proc sql;
create table vars as
select name
from dictionary.columns
where libname = upcase("&amp;amp;inlib.") and memname = upcase("&amp;amp;inset.")
order by name;
quit;

data _null_;
set vars end=done;
if _n_ = 1 then call execute("data &amp;amp;outlib..&amp;amp;outset.; format ");
call execute(name !! ' ');
if done then call execute("; set &amp;amp;inlib..&amp;amp;inset.; run;");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can easily wrap that into a macro with the four macrovars as macro parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2017 06:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-sort-variables-in-alphabetical-order-as-Output-data-in/m-p/388375#M25037</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-16T06:33:17Z</dc:date>
    </item>
  </channel>
</rss>

