<?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 recode variable using counts in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71299#M20571</link>
    <description>Hi:&lt;BR /&gt;
  This Tech Support note:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/15/138.html" target="_blank"&gt;http://support.sas.com/kb/15/138.html&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
says &lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;"The MONOTONIC() function is not supported in PROC SQL.  Using the&lt;BR /&gt;
MONOTONIC() function in PROC SQL can cause missing or non-sequential&lt;BR /&gt;
values to be returned."&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
So before you go too far down this SQL road with MONOTONIC, you may want to post a small sample of fake data and show the desired results and tell us, in addition:&lt;BR /&gt;
1) whether your desired output is a report or a dataset&lt;BR /&gt;
2) if a report, what your ODS destination of interest is (HTML, RTF, PDF)&lt;BR /&gt;
&lt;BR /&gt;
...and perhaps someone can come up with some ideas that do not require the use of MONOTONIC.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia</description>
    <pubDate>Sat, 11 Sep 2010 01:36:19 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-09-11T01:36:19Z</dc:date>
    <item>
      <title>how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71295#M20567</link>
      <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
This might be a simple question but I would appreciate some help. I have a series of categorical variables that I would like to recode based on their frequency/count. &lt;BR /&gt;
&lt;BR /&gt;
So, for example, if I had a series of records in the variable being a, a, a, b, b, c, I would like to recode my variable so that 'a ' (having the highest count) would be coded as 3 and 'c' (having the lowest count) would be coded as 1. Since I have a series of variables it would be hard to recode them manually so was wondering whether there was a command to easily do this.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Fri, 10 Sep 2010 18:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71295#M20567</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-10T18:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71296#M20568</link>
      <description>Can you post two sample files, namely what you have and the file that you'd like to have?&lt;BR /&gt;
&lt;BR /&gt;
Somehow, I don't think you would find a record that showed: 3,3,3,2,2,1 of much use.&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Fri, 10 Sep 2010 19:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71296#M20568</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-09-10T19:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71297#M20569</link>
      <description>I'm assuming that you need to rank them by their frequency.&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
  create table sample1 as select var1, monotonic() as rank from&lt;BR /&gt;
                                 (select distinct var1,&lt;BR /&gt;
                                 count(var1) as count1&lt;BR /&gt;
                          from work.sample&lt;BR /&gt;
                          group by var1&lt;BR /&gt;
                          order by count1)&lt;BR /&gt;
                         order by rank;&lt;BR /&gt;
quit;  &lt;BR /&gt;
                                   &lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sandhya.</description>
      <pubDate>Fri, 10 Sep 2010 19:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71297#M20569</guid>
      <dc:creator>Sandhya</dc:creator>
      <dc:date>2010-09-10T19:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71298#M20570</link>
      <description>Hi Sandhya,&lt;BR /&gt;
Yes I wanted to rank the variables by their frequency. Thanks for this! I'll let you know whether I'm successful.</description>
      <pubDate>Fri, 10 Sep 2010 21:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71298#M20570</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-09-10T21:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71299#M20571</link>
      <description>Hi:&lt;BR /&gt;
  This Tech Support note:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/15/138.html" target="_blank"&gt;http://support.sas.com/kb/15/138.html&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
says &lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;"The MONOTONIC() function is not supported in PROC SQL.  Using the&lt;BR /&gt;
MONOTONIC() function in PROC SQL can cause missing or non-sequential&lt;BR /&gt;
values to be returned."&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
 &lt;BR /&gt;
So before you go too far down this SQL road with MONOTONIC, you may want to post a small sample of fake data and show the desired results and tell us, in addition:&lt;BR /&gt;
1) whether your desired output is a report or a dataset&lt;BR /&gt;
2) if a report, what your ODS destination of interest is (HTML, RTF, PDF)&lt;BR /&gt;
&lt;BR /&gt;
...and perhaps someone can come up with some ideas that do not require the use of MONOTONIC.&lt;BR /&gt;
   &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 11 Sep 2010 01:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71299#M20571</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-09-11T01:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71300#M20572</link>
      <description>An additional thought.&lt;BR /&gt;
                  &lt;BR /&gt;
If all you want is a report (as opposed to actually recoding the variables), then perhaps PROC FREQ will do what you want:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data myrecs;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input name $ var1 $ var2 $ var3;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
alan  b x 4&lt;BR /&gt;
bob   c x 5&lt;BR /&gt;
carla a x 5&lt;BR /&gt;
don   c x 5&lt;BR /&gt;
ed    a y 6&lt;BR /&gt;
frank a y 6&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                               &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\rankvars.html' style=sasweb;&lt;BR /&gt;
proc freq data=myrecs order=freq;&lt;BR /&gt;
 tables var: ;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                   &lt;BR /&gt;
If what you want to do is to show the detail observations/records, but in the order of their rank, then you can do that with PROC REPORT, as shown below (and, PROC REPORT can also make you an output dataset). Since you can only order by one variable at a time, I coded the PROC REPORT step to order by the descending frequency for values of VAR1.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\sol_PROC_REPORT.html' style=sasweb;&lt;BR /&gt;
proc report data=myrecs nowd&lt;BR /&gt;
            out=rankv1out(drop=n var1show where=(_break_ eq ' '));&lt;BR /&gt;
  title '1) PROC REPORT output in order of Var1 Frequency';&lt;BR /&gt;
  title2 'you may or may not want VAR1SHOW variable in the report';&lt;BR /&gt;
  column var1 name var1show var2 var3 n rankv1;&lt;BR /&gt;
  define var1 / order order=freq descending noprint;&lt;BR /&gt;
  define name / display;&lt;BR /&gt;
  define var1show / computed;&lt;BR /&gt;
  define var2 / display;&lt;BR /&gt;
  define var3 / display;&lt;BR /&gt;
  define n / noprint;&lt;BR /&gt;
  define rankv1 / computed;&lt;BR /&gt;
  break before var1 / ;&lt;BR /&gt;
  compute before var1;&lt;BR /&gt;
    hold = var1;&lt;BR /&gt;
    holdcnt = n;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute var1show / character length=1;&lt;BR /&gt;
    var1show = hold;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute rankv1;&lt;BR /&gt;
    rankv1 = holdcnt;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
                                       &lt;BR /&gt;
proc print data=rankv1out(drop=_break_);&lt;BR /&gt;
  title '2) Output Dataset created by PROC REPORT';&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 11 Sep 2010 02:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71300#M20572</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-09-11T02:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71301#M20573</link>
      <description>PROC SUMMARY has everything you need to compute the ordered frequency and create a variable to ID each level of the character variable based on frequency.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
   do _n_ = 1 to 20;&lt;BR /&gt;
      length c $1;&lt;BR /&gt;
      c = substr('abcdefghi',rantbl(123456,.2,.1,.4,.15),1);&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;B&gt;proc summary nway;&lt;BR /&gt;
   class c / order=freq ascending;&lt;BR /&gt;
   output out=code(drop=_type_ index=(c)) / levels;&lt;BR /&gt;
   run;&lt;/B&gt;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
data test2;&lt;BR /&gt;
   set test;&lt;BR /&gt;
   set code key=c/unique;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 11 Sep 2010 11:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71301#M20573</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-09-11T11:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71302#M20574</link>
      <description>[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
   do _n_ = 1 to 20;&lt;BR /&gt;
      length c $1;&lt;BR /&gt;
      c = substr('abcdefghi',rantbl(123456,.2,.1,.4,.15),1);&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc freq data=test ;&lt;BR /&gt;
 tables c /out=freq;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=test;&lt;BR /&gt;
 by c;&lt;BR /&gt;
run;&lt;BR /&gt;
data result;&lt;BR /&gt;
 merge test freq;&lt;BR /&gt;
 by c;&lt;BR /&gt;
 keep c count;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 14 Sep 2010 02:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71302#M20574</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-09-14T02:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71303#M20575</link>
      <description>Most of the answers so far seem to miss the OP's point -- which is that OP has a *series* variables to recode. _null_'s brilliant use of proc summary does not seem to extend nicely to multiple variables -- repeatedly running one proc summary per variable can be quite expensive if the data are large.&lt;BR /&gt;
&lt;BR /&gt;
This kind of vector-oriented operations are, by nature, very easy to implement in vector/matrix oriented languages like R, but quite awkward for Base SAS -- IML may handle this more easily.  &lt;BR /&gt;
&lt;BR /&gt;
Below is my try using Base SAS and some macro variables. It assumes an input of two macro variables, olds and news, both are a single-blank delimited list of variable names, to recode from, and to be recoded into, respectively. The recoding is done in such a way that if there were ties in terms of frequencies, then they are broken by the value's alphabetical order.  Missing values are properly propagated.&lt;BR /&gt;
&lt;BR /&gt;
Code below is admittedly ugly at best and I am not really happy with it. I would love to post this question on sas-l to see what they can come up with.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
/* test data */&lt;BR /&gt;
data one;&lt;BR /&gt;
  input id (v1-v5) ($);&lt;BR /&gt;
cards;&lt;BR /&gt;
1 a a a . a&lt;BR /&gt;
2 a b b . a&lt;BR /&gt;
3 a c c . a&lt;BR /&gt;
4 b c d . a&lt;BR /&gt;
5 b c e . a&lt;BR /&gt;
6 c c . . a&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%let olds = v1 v2 v3 v4 v5;&lt;BR /&gt;
%let news = n1 n2 n3 n4 n5;&lt;BR /&gt;
&lt;BR /&gt;
ods output OneWayFreqs=freqs;&lt;BR /&gt;
  proc freq data=one order=freq;&lt;BR /&gt;
    tables &amp;amp;olds;&lt;BR /&gt;
  run;&lt;BR /&gt;
ods output clear;&lt;BR /&gt;
proc freq data=freqs;&lt;BR /&gt;
  tables table/out=levels(keep=table count);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%let cOlds = %sysfunc(translate(&amp;amp;olds,%str(,),%str( )));&lt;BR /&gt;
data lookup;&lt;BR /&gt;
  length name $32 value $200;&lt;BR /&gt;
  do i = 0 by 1 until (last.table);&lt;BR /&gt;
    merge freqs levels;&lt;BR /&gt;
    by table;&lt;BR /&gt;
    name = scan(table, 2);&lt;BR /&gt;
    value = coalescec(&amp;amp;cOlds);&lt;BR /&gt;
    target = count - i;&lt;BR /&gt;
    if (frequency &amp;gt; 0) then output;&lt;BR /&gt;
  end;&lt;BR /&gt;
  keep name value target frequency;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data two;&lt;BR /&gt;
  set one;&lt;BR /&gt;
  if _n_ = 1 then do;&lt;BR /&gt;
    dcl hash h(dataset:"lookup");&lt;BR /&gt;
    h.definekey('name', 'value');&lt;BR /&gt;
    h.definedata('target');&lt;BR /&gt;
    h.definedone();&lt;BR /&gt;
  end;&lt;BR /&gt;
  array olds{*} $ &amp;amp;olds;&lt;BR /&gt;
  array news{*} &amp;amp;news;&lt;BR /&gt;
  do i = 1 to dim(olds);&lt;BR /&gt;
    name = vname(olds{i});&lt;BR /&gt;
    value = olds{i};&lt;BR /&gt;
    if (h.find()^=0) then target = .;&lt;BR /&gt;
    news{i} = target;&lt;BR /&gt;
  end;&lt;BR /&gt;
  keep id &amp;amp;olds &amp;amp;news;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
/* check */&lt;BR /&gt;
proc print data=two noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
/* on lst&lt;BR /&gt;
id v1 v2 v3 v4 v5  n1 n2 n3 n4 n5&lt;BR /&gt;
 1 a  a  a     a    3  2  5  .  1&lt;BR /&gt;
 2 a  b  b     a    3  1  4  .  1&lt;BR /&gt;
 3 a  c  c     a    3  3  3  .  1&lt;BR /&gt;
 4 b  c  d     a    2  3  2  .  1&lt;BR /&gt;
 5 b  c  e     a    2  3  1  .  1&lt;BR /&gt;
 6 c  c        a    1  3  .  .  1&lt;BR /&gt;
*/&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 14 Sep 2010 21:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71303#M20575</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2010-09-14T21:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71304#M20576</link>
      <description>SAS-L does not disappoint. Check out these excellent solutions:&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1009c&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;P=5849" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1009c&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;P=5849&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1009c&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=D&amp;amp;P=6542" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1009c&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=D&amp;amp;P=6542&lt;/A&gt;</description>
      <pubDate>Thu, 16 Sep 2010 16:17:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71304#M20576</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2010-09-16T16:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to recode variable using counts</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71305#M20577</link>
      <description>Here is an alternative solution.  This solution uses one sql step and then a single pass through the data with a data step:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro recode(dataset, vars);&lt;BR /&gt;
	proc sql noprint;&lt;BR /&gt;
	%let i=1;&lt;BR /&gt;
	%do %until(%scan(&amp;amp;vars, &amp;amp;i) = );&lt;BR /&gt;
		%let var = %scan(&amp;amp;vars, &amp;amp;i);&lt;BR /&gt;
		%local &amp;amp;var;&lt;BR /&gt;
 			select &amp;amp;var into: &amp;amp;var separated by ' ' from &lt;BR /&gt;
				(select &amp;amp;var, count(*) as count from &amp;amp;dataset where &amp;amp;var ne '' group by &amp;amp;var)&lt;BR /&gt;
			order by count, &amp;amp;var desc;&lt;BR /&gt;
		%let i = %eval(&amp;amp;i + 1);&lt;BR /&gt;
	%end;&lt;BR /&gt;
	quit;&lt;BR /&gt;
&lt;BR /&gt;
	data &amp;amp;dataset._recode;&lt;BR /&gt;
		set &amp;amp;dataset;&lt;BR /&gt;
		%let i = 1;&lt;BR /&gt;
		%do %until(%scan(&amp;amp;vars, &amp;amp;i)= );&lt;BR /&gt;
			%let var = %scan(&amp;amp;vars, &amp;amp;i);&lt;BR /&gt;
			%let j=1;&lt;BR /&gt;
			%do %until(%scan(&amp;amp;&amp;amp;&amp;amp;var, &amp;amp;j)= );&lt;BR /&gt;
				%if %eval(&amp;amp;j &amp;gt; 1) %then else ;&lt;BR /&gt;
				if &amp;amp;var = "%scan(&amp;amp;&amp;amp;&amp;amp;var, &amp;amp;j)" and &amp;amp;var ne "" then &amp;amp;var._recode = &amp;amp;j;&lt;BR /&gt;
				%let j = %eval(&amp;amp;j + 1);&lt;BR /&gt;
			%end;&lt;BR /&gt;
			else &amp;amp;var._recode = .;&lt;BR /&gt;
			%let i = %eval(&amp;amp;i + 1);&lt;BR /&gt;
		%end;&lt;BR /&gt;
	run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
input id (v1-v5) ($);&lt;BR /&gt;
cards;&lt;BR /&gt;
1 a a a . a&lt;BR /&gt;
2 a b b . a&lt;BR /&gt;
3 a c c . a&lt;BR /&gt;
4 b c d . a&lt;BR /&gt;
5 b c e . a&lt;BR /&gt;
6 c c . . a&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%recode(one, v1 v2 v3 v4 v5)&lt;BR /&gt;
&lt;BR /&gt;
proc print data=one_recode;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: polingjw

Message was edited by: polingjw</description>
      <pubDate>Mon, 20 Sep 2010 11:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-recode-variable-using-counts/m-p/71305#M20577</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-09-20T11:25:38Z</dc:date>
    </item>
  </channel>
</rss>

