<?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: repeat same procedure for each variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286441#M58737</link>
    <description>&lt;P&gt;Sorry i should have make my queations more clearly. Say I have the following data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;grade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; age&lt;/P&gt;&lt;P&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;I want to use proc rank to rank the two variables in five groups:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;rank&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;groups&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=5&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=rank &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _ALL_;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ranks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; grade_rank age_rank;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;But since i have hundreds of variables, i cannot name every new names in 'ranks'. And i want the new coloumn names contains the original variable name then end or begins with 'rank'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm thinking about using array or macro, but it doesn't work. I don't have that codes anymore, i deleted them already.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why i mentioned rename is that, now i'm using code:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;rank&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;groups&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=5&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=rank &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _ALL_;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ranks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; rank1-rank100;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;And i tried to rename rank1 - rank 100 to the name i desired. I cannot get this done neither........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks again!!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Best,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2016 17:13:14 GMT</pubDate>
    <dc:creator>Xiaoningdemao</dc:creator>
    <dc:date>2016-07-22T17:13:14Z</dc:date>
    <item>
      <title>repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286269#M58676</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use apply a same procedure on each variable. For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. rename old variable &amp;nbsp;sex age &amp;nbsp;to sex_new&amp;nbsp;&amp;nbsp; sex_old;&lt;/P&gt;&lt;P&gt;2. proc rank&amp;nbsp; each variable and fit model using ranks;&lt;/P&gt;&lt;P&gt;so on so forth.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried array and macro but just can't get it work........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 20:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286269#M58676</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-21T20:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286287#M58686</link>
      <description>&lt;P&gt;Please show the code of what you tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are not going to be able to rename using array, that is either a rename statement or use proc datasets with a modify section for that dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What type of rank? On which variables? What kind of model? What dependent variable(s)? What independent variables?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 22:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286287#M58686</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-21T22:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286441#M58737</link>
      <description>&lt;P&gt;Sorry i should have make my queations more clearly. Say I have the following data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;grade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; age&lt;/P&gt;&lt;P&gt;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;I want to use proc rank to rank the two variables in five groups:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;rank&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;groups&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=5&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=rank &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _ALL_;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ranks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; grade_rank age_rank;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;But since i have hundreds of variables, i cannot name every new names in 'ranks'. And i want the new coloumn names contains the original variable name then end or begins with 'rank'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm thinking about using array or macro, but it doesn't work. I don't have that codes anymore, i deleted them already.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why i mentioned rename is that, now i'm using code:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;rank&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;groups&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=5&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=rank &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=data;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; _ALL_;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ranks&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; rank1-rank100;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;And i tried to rename rank1 - rank 100 to the name i desired. I cannot get this done neither........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks again!!&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Best,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 17:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286441#M58737</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-22T17:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286447#M58740</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; This documentation example shows using GROUPS= with PROC RANK:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/68954/HTML/default/viewer.htm#p1xzpoijq32wbsn1gr6g5cx3emsx.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/68954/HTML/default/viewer.htm#p1xzpoijq32wbsn1gr6g5cx3emsx.htm&lt;/A&gt; (Example 3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; And assuming that you want all the numeric variables to be ranked, you can modify this example to make a macro variable to hold the names of all the numeric variables and then a second macro variable to hold the names of the "rank_" varible to be created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's the code (the PROC SQL step is the modification from the documentation):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options nodate pageno=1 linesize=80 pagesize=60;
data swim;
   input Name $ 1-7 Gender $ 9 Back 11-14 Free 16-19;
   datalines;
Andrea  F 28.6 30.3
Carole  F 32.9 24.0
Clayton M 27.0 21.9
Curtis  M 29.0 22.6
Doug    M 27.3 22.4
Ellen   F 27.8 27.0
Jan     F 31.3 31.2
Jimmy   M 26.3 22.5
Karin   F 34.6 26.2
Mick    M 29.0 25.4
Richard M 29.7 30.2
Sam     M 27.2 24.1
Susan   F 35.1 36.1
;
run;
    
proc sql;
  select name, catx('_','rank',name) into :vname separated by ' ',
                                          :rname separated by ' '
  from dictionary.columns
  where (libname='WORK' and memname = 'SWIM') and
        type = 'num';
 
quit;
  
%put vname is &amp;amp;vname;
%put rname is &amp;amp;rname;
    
proc sort data=swim out=pairs;
   by gender;
run;
    
proc rank data=pairs out=rankpair groups=3;
by gender;
var &amp;amp;vname;
ranks &amp;amp;rname;
run;
  
proc print data=rankpair n;
   by gender;
   title 'Pairings of Swimmers for Backstroke and Freestyle';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here are the results:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4186iF60A3D2A4FEB3459/image-size/original?v=v2&amp;amp;px=-1" alt="rank_rename.png" title="rank_rename.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 17:46:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286447#M58740</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-22T17:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286501#M58769</link>
      <description>Hi Cynthia,&lt;BR /&gt;Thank you! I changed 'swim' in this code to the data name I have, but it doesn't work. And what is the meaning of 'dictionary.columns' ?&lt;BR /&gt;Thanks again!!&lt;BR /&gt;Best,&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Jul 2016 22:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286501#M58769</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-22T22:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286503#M58771</link>
      <description>Hi Cynthia,&lt;BR /&gt;I just realized the reason it doesn't work is because I didn't capitalize my data name. So 'SWIM' works but 'swim' doesn't. Why is this? I thought SAS doesn't differentiate case.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Jul 2016 22:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286503#M58771</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-22T22:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286504#M58772</link>
      <description>Hi:&lt;BR /&gt;  WORK.SWIM is the name of the dataset I created in the very first step in the example (the code with the DATALINES.&lt;BR /&gt;&lt;BR /&gt;  Next, DICTIONARY.COLUMNS is a special table that is built for a SAS session that keeps track of the data that you are using. So in my PROC SQL step, when I have this:&lt;BR /&gt;  where (libname='WORK' and memname = 'SWIM') and&lt;BR /&gt;        type = 'num';&lt;BR /&gt;&lt;BR /&gt;The library is WORK and the dataset name is SWIM. In your example, you did not show your library or dataset name. You can't just change SWIM to your data name. You will have to change the LIBNAME too. And DICTIONARY.COLUMNS stores the values in UPPER case, so you need to alter the code appropriately.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 22 Jul 2016 22:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286504#M58772</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-22T22:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286507#M58775</link>
      <description>I see, thank you!&lt;BR /&gt;I just have one more question. So right now &amp;amp;vname &amp;amp;rname stores all variable names in data swim. Say in future I only need the rank of variable free. is there a way to use part of the &amp;amp;rname?&lt;BR /&gt;I tried:&lt;BR /&gt;proc rank data=modeldata out=rank groups=5;&lt;BR /&gt;var &amp;amp;vname[2];&lt;BR /&gt;ranks &amp;amp;rname[2];&lt;BR /&gt;&lt;BR /&gt;it doesn't work.&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;run;</description>
      <pubDate>Fri, 22 Jul 2016 22:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286507#M58775</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-22T22:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286508#M58776</link>
      <description>As I explained, the values in DICTIONARY.COLUMNS are physically stored in UPPERCASE. So, as for ANY comparison, you must do this:&lt;BR /&gt;where libname='WORK' or where LIBname='WORK'&lt;BR /&gt;&lt;BR /&gt;notice that the case of LIBNAME is irrelevant, but the case of the value for LIBNAME is case-sensitive.&lt;BR /&gt;&lt;BR /&gt;And, regarding this -- the short answer is no...you are wanting to treat the list like it is an array and this is an incorrect understanding of what is stored in the macro variable. So what you propose will not work:&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;proc rank data=modeldata out=rank groups=5;&lt;BR /&gt;var &amp;amp;vname[2];&lt;BR /&gt;ranks &amp;amp;rname[2];&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 22 Jul 2016 22:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286508#M58776</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-22T22:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: repeat same procedure for each variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286517#M58784</link>
      <description>I see. Thank you!!&lt;BR /&gt;Have a nice weekend &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 22 Jul 2016 23:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/repeat-same-procedure-for-each-variable/m-p/286517#M58784</guid>
      <dc:creator>Xiaoningdemao</dc:creator>
      <dc:date>2016-07-22T23:27:28Z</dc:date>
    </item>
  </channel>
</rss>

