<?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: variables in a-z manner in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69215#M19859</link>
    <description>Hi to all,&lt;BR /&gt;
&lt;BR /&gt;
try to see this&lt;BR /&gt;
&lt;BR /&gt;
Sample 24696: Reordering variables to be in alphabetical order&lt;BR /&gt;
&lt;BR /&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;</description>
    <pubDate>Thu, 03 Sep 2009 22:11:49 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-09-03T22:11:49Z</dc:date>
    <item>
      <title>variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69208#M19852</link>
      <description>hi i am haivng variables .i wan them in a-z manner.&lt;BR /&gt;
&lt;BR /&gt;
data fin;&lt;BR /&gt;
input w a x z p;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 2 3 5 6&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
i wna them in a-z manner&lt;BR /&gt;
a p w x z&lt;BR /&gt;
&lt;BR /&gt;
how can i do it.</description>
      <pubDate>Thu, 03 Sep 2009 07:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69208#M19852</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2009-09-03T07:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69209#M19853</link>
      <description>Hi R_Win,&lt;BR /&gt;
&lt;BR /&gt;
try this one.&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=fin out=trans;&lt;BR /&gt;
        var _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=trans; &lt;BR /&gt;
        by _name_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=trans out=trans2;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Milton</description>
      <pubDate>Thu, 03 Sep 2009 08:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69209#M19853</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2009-09-03T08:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69210#M19854</link>
      <description>The data set flip-flop using TRANSPOSE is a useful technique.  However, it will cause all variables to be converted to character if any variables in the VAR list are character.  The conversion to character can be a useful but that is another subject.&lt;BR /&gt;
&lt;BR /&gt;
You can use DICTIONARY.COLUMNS to produce a alphabetical list of variables.  Although there will be problems with that if any of the variables are members of an enumerated variable lists.  For example B1-B10 will come out B1 B10 B2 and so on.  PROC CONTENTS produces the correct ordering.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data fin;&lt;BR /&gt;
   input w a x z p;&lt;BR /&gt;
   B5=1;&lt;BR /&gt;
   array b[10];&lt;BR /&gt;
   cards;&lt;BR /&gt;
1 2 3 5 6&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
   select name into :alphaList separated by ' '&lt;BR /&gt;
      from dictionary.columns&lt;BR /&gt;
      where libname eq 'WORK' and memname eq 'FIN'&lt;BR /&gt;
      order by 1&lt;BR /&gt;
      ;&lt;BR /&gt;
   quit;&lt;BR /&gt;
   run;&lt;BR /&gt;
/* use ALPHALIST as you see fit */&lt;BR /&gt;
%put NOTE: ALPHALIST=&amp;amp;alphalist;&lt;BR /&gt;
  &lt;BR /&gt;
  &lt;BR /&gt;
/* correct order for alphalist with enumerated variables list*/&lt;BR /&gt;
&lt;BR /&gt;
proc contents noprint order=ignorecase out=alphalist(keep=name);&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
   select name into :alphaList separated by ' '&lt;BR /&gt;
      from alphalist&lt;BR /&gt;
      ;&lt;BR /&gt;
   quit;&lt;BR /&gt;
   run;&lt;BR /&gt;
/* use ALPHALIST as you see fit */&lt;BR /&gt;
%put NOTE: ALPHALIST=&amp;amp;alphalist;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 03 Sep 2009 11:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69210#M19854</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-09-03T11:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69211#M19855</link>
      <description>Another approach is to populate the "program data vector" with the names in the order that you want before doing the input statement.  (search the documentation for 'program data vector' for more than you may want to know; there are some kinks if you mix numeric and character variables).&lt;BR /&gt;
&lt;BR /&gt;
In your example, adding a KEEP statement before the INPUT will produce the desired results.&lt;BR /&gt;
&lt;BR /&gt;
data fin;&lt;BR /&gt;
KEEP a p w x z;&lt;BR /&gt;
input w a x z p;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 2 3 5 6&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 03 Sep 2009 14:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69211#M19855</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-09-03T14:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69212#M19856</link>
      <description>KEEP wont do that.  I think I may have in the "old" days V5 and before.  No way to test that now.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data fin;&lt;BR /&gt;
   KEEP a p w x z;&lt;BR /&gt;
   put (_all_)(=); ** Shows that no variables are defined at this point in program*;&lt;BR /&gt;
   input w a x z p;&lt;BR /&gt;
   cards;&lt;BR /&gt;
1 2 3 5 6&lt;BR /&gt;
;&lt;BR /&gt;
   run; &lt;BR /&gt;
proc contents varnum;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 03 Sep 2009 14:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69212#M19856</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-09-03T14:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69213#M19857</link>
      <description>You are showing my age!&lt;BR /&gt;
&lt;BR /&gt;
Replacing the KEEP with a LENGTH statement will work.&lt;BR /&gt;
   LENGTH a p w x z 4;</description>
      <pubDate>Thu, 03 Sep 2009 15:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69213#M19857</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-09-03T15:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69214#M19858</link>
      <description>There was a long thread or 2 about this a while back.  RETAIN works without having to specify the variable type.</description>
      <pubDate>Thu, 03 Sep 2009 15:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69214#M19858</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-09-03T15:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69215#M19859</link>
      <description>Hi to all,&lt;BR /&gt;
&lt;BR /&gt;
try to see this&lt;BR /&gt;
&lt;BR /&gt;
Sample 24696: Reordering variables to be in alphabetical order&lt;BR /&gt;
&lt;BR /&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;</description>
      <pubDate>Thu, 03 Sep 2009 22:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69215#M19859</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-03T22:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: variables in a-z manner</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69216#M19860</link>
      <description>/*Put all the variables into Alphabetical order;*/ &lt;BR /&gt;
&lt;BR /&gt;
data fin;&lt;BR /&gt;
input w a x z p;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 2 3 5 6&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select name into: new separated by ','&lt;BR /&gt;
from dictionary.columns where libname='WORK' and memname='FIN'&lt;BR /&gt;
order by name;&lt;BR /&gt;
create table fin_1 as select &amp;amp;new. from fin;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Read more : &lt;A href="http://studysas.blogspot.com/2009/07/dictionary-tables-and-sashelp-views.html" target="_blank"&gt;http://studysas.blogspot.com/2009/07/dictionary-tables-and-sashelp-views.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Sarath</description>
      <pubDate>Tue, 08 Sep 2009 12:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variables-in-a-z-manner/m-p/69216#M19860</guid>
      <dc:creator>sarathannapareddy</dc:creator>
      <dc:date>2009-09-08T12:43:06Z</dc:date>
    </item>
  </channel>
</rss>

