<?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: Looping through columns in groups of 4, combining columns and reassigning values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199016#M49706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I missed a comma retyping into the forum:&lt;/P&gt;&lt;P&gt;varlist separated by ' ' &lt;STRONG&gt;,&lt;/STRONG&gt; : varcount&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Apr 2015 18:06:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-04-20T18:06:27Z</dc:date>
    <item>
      <title>Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199007#M49697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some data which looks like below. The columns are actually in groups of 4 which just represent a 4 point scale. i.e. columns a, b, c &amp;amp; d represent the same variable where a = 4, b = 3, c = 2 and d = 1. Similarly e = 4, f = 3, g = 2 and h = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value 1 in 'a' means , 'a' has been selected by respondent and the value to be assigned for columns a, b, c and d for record 1 is 4 on the 4-point scale. The value 1 in column g means for the group of e, f, g &amp;amp; h, g has been chosen as the correct option by respondent and a 2 should be assigned for variable represented by group e, f, g &amp;amp; h. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HAVE:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffff00;"&gt;a&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffff00;"&gt;b&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffff00;"&gt;c&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffff00;"&gt;d&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;e&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;f&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;g&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;h&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WANT:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;VAR1 (a, b, c, d)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;VAR2 (e, f, g, h)&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i achieve this? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 19:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199007#M49697</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-17T19:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199008#M49698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="SASPic1.jpg" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/10098_SASPic1.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 20:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199008#M49698</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-17T20:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199009#M49699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here are two ways, one an assignment approach and the other with and informat. If you have lots of these variables I would recommend the format approach. Or go back to the survey software that created these and look at the export options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;invalue groupfour&lt;/P&gt;&lt;P&gt;'1000'=4&lt;/P&gt;&lt;P&gt;'0100'=3&lt;/P&gt;&lt;P&gt;'0010'=2&lt;/P&gt;&lt;P&gt;'0001'=1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data work.test;&lt;/P&gt;&lt;P&gt;input a b c d e f g h ;&lt;/P&gt;&lt;P&gt;var1 = a*4 + b*3 + c*2 + d;&lt;/P&gt;&lt;P&gt;var2 = input(cats(e,f,g,h),groupfour.);&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 0 0 0 0 0 1 0 &lt;/P&gt;&lt;P&gt;0 0 1 0 1 0 0 0 &lt;/P&gt;&lt;P&gt;0 0 0 1 0 1 0 0 &lt;/P&gt;&lt;P&gt;0 1 0 0 0 0 0 1 &lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 20:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199009#M49699</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-17T20:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199010#M49700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;


data work.test;
input a b c d e f g h ;
array x{*} d c b a;
array y{*} h g f e;
v1=whichn(1,of x{*});
v2=whichn(1,of y{*});
datalines;
1 0 0 0 0 0 1 0
0 0 1 0 1 0 0 0
0 0 0 1 0 1 0 0
0 1 0 0 0 0 0 1
;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Apr 2015 07:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199010#M49700</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-18T07:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199011#M49701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi BallardW, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the format approach is really cool . I have one question through - my original dataset has a lot of columns. Eventually the column names run into AB, AC , AD up to FV. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't want to type:&lt;/P&gt;&lt;P&gt;input(cats(e,f,g,h), groupfour.); &lt;/P&gt;&lt;P&gt;input(cats(i,j,k,l), groupfour.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Isn't there someway I can ask SAS to apply groupfour. to successive 4 columns and keep creating new variable names?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 15:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199011#M49701</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-20T15:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199012#M49702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Xia, very good approach - I didn;t know the whichn function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way we can save the keystrokes when creating array ? There are many columns in my dataset - Can we code SAS to go through 4 columns and make arrays out of them? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 15:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199012#M49702</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-20T15:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199013#M49703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a number of approaches available depending upon your level of coding comfort. &lt;/P&gt;&lt;P&gt;The easiest might be an array but the variables would need to be presented in the correct order for an array statement:&lt;/P&gt;&lt;P&gt;array group a b c d &amp;lt;etc&amp;gt;&lt;/P&gt;&lt;P&gt;The trickier part is creating the names for the NEW variables.&lt;/P&gt;&lt;P&gt;You can get a list of all of the variable names&amp;nbsp; and count of variables into a macro variable by:&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select name, count(*)/4 into : varlist separated by ' ' : varcount&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns where libname='LIB' &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and memname='DATA';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;Put the name of your library and dataset in place of LIB and DATA IN CAPITAL LETTERS;&lt;/P&gt;&lt;P&gt;You can use %put to see the value in the log. If only variables you want appear, and are in the correct order in the Varlist variable you can use &amp;amp;varlist.&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array group &amp;amp;varlist; &lt;/P&gt;&lt;P&gt;array newvar&amp;nbsp; Var1 - Var&amp;amp;varcount;&lt;/P&gt;&lt;P&gt;do I = 1 to &amp;amp;varcount;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base = (I-1)*4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar&lt;I&gt; =&amp;nbsp; input(cats(group[base+1],group[base+2],group[base+3],group[base+4]),groupfour.);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop I base;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 15:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199013#M49703</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-20T15:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199014#M49704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "VARCOUNT".&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; 200&lt;/P&gt;&lt;P&gt;ERROR: Missing numeric suffix on a numbered variable list (Var1-Var).&lt;/P&gt;&lt;P&gt;WARNING: Defining an array with zero elements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though the macro variable &amp;amp;varcount is recognized, a numeric suffix is required it says.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 16:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199014#M49704</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-20T16:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199015#M49705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trying another approach: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input a b c d e f g h i j k l;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;1 0 0 0 0 1 0 0 1 0 0 0&lt;/P&gt;&lt;P&gt;0 1 0 0 0 0 1 0 0 1 0 0&lt;/P&gt;&lt;P&gt;0 0 1 0 1 0 0 0 1 0 0 0&lt;/P&gt;&lt;P&gt;0 0 0 1 0 0 0 1 0 0 1 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data = test out = test_t;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test_t;&lt;/P&gt;&lt;P&gt;set test_t;&lt;/P&gt;&lt;P&gt;retain block;&lt;/P&gt;&lt;P&gt;if _n_ = 1 then block = 1;&lt;/P&gt;&lt;P&gt;if mod(_n_/4,1) = 0.25 and _n_ gt 1 then block +1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 384px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="64"&gt;Name&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;Col1&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;Col2&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;Col3&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;Col4&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="64"&gt;block&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;a&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;b&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;c&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;d&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;e&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;f&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;g&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;h&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;i&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;j&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;k&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;l&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl63" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way I can group this by "block" to get something like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" width="64"&gt;block&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;col1&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;col2&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;col3&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;col4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0100&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0010&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0100&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0010&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0100&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;0010&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 17:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199015#M49705</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-20T17:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199016#M49706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I missed a comma retyping into the forum:&lt;/P&gt;&lt;P&gt;varlist separated by ' ' &lt;STRONG&gt;,&lt;/STRONG&gt; : varcount&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 18:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199016#M49706</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-20T18:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199017#M49707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh no I corrected that. The error is occurring in the next block -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array group &amp;amp;varlist;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array newvar&amp;nbsp; Var1 - Var&amp;amp;varcount;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do I = 1 to &amp;amp;varcount;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base = (I-1)*4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar&lt;I&gt; =&amp;nbsp; input(cats(group[base+1],group[base+2],group[base+3],group[base+4]),groupfour.);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop I base;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OTE: Line generated by the macro variable "VARCOUNT".&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; 200&lt;/P&gt;&lt;P&gt;ERROR: Missing numeric suffix on a numbered variable list (Var1-Var).&lt;/P&gt;&lt;P&gt;WARNING: Defining an array with zero elements.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, (, ;, _ALL_, _CHARACTER_,&lt;/P&gt;&lt;P&gt;&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; _CHAR_, _NUMERIC_.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 18:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199017#M49707</guid>
      <dc:creator>ngnikhilgoyal</dc:creator>
      <dc:date>2015-04-20T18:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199018#M49708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before the data step after creating varcount:&lt;/P&gt;&lt;P&gt;%let varcount=%left(&amp;amp;varcount);&lt;/P&gt;&lt;P&gt;The SQL is placing leading spaces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 20:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199018#M49708</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-20T20:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through columns in groups of 4, combining columns and reassigning values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199019#M49709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the WHICHN() function to figure our which one of the four has a 1 in it.&amp;nbsp; But that assumes clean data with only one 1 in any group (or if more than 1 is set then that the highest one "wins").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a b c d e f g h i j k l m n o p q r s t ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; x a -- t ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; value (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; row=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dim(x)/&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; value(row)=whichn(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,x(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;*(row-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;),x(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;*(row-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;),x(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;*(row-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;),x(&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;*(row-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (x(*)) (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt; &lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; +&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; / (value(*)) (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2.&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; +&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 0 0 0&amp;nbsp;&amp;nbsp; 0 1 0 0&amp;nbsp;&amp;nbsp; 0 0 1 0&amp;nbsp;&amp;nbsp; 0 0 0 1&amp;nbsp;&amp;nbsp; 0 0 0 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 21:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Looping-through-columns-in-groups-of-4-combining-columns-and/m-p/199019#M49709</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-04-20T21:13:52Z</dc:date>
    </item>
  </channel>
</rss>

