<?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 array variables longways side by side in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334006#M9852</link>
    <description>&lt;P&gt;I don't know your logic so you'll have to incorporate but if you require ALL of the variables to be not missing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if nmiss(var11,var25,var34) = 0 then output;&lt;/P&gt;
&lt;P&gt;may be one way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previously you were looking at individual values so&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2017 23:58:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-02-17T23:58:10Z</dc:date>
    <item>
      <title>how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333868#M9844</link>
      <description>&lt;P&gt;Hey everyone - I have a dataset where the variables are situated in rows, however, I would like to flip them vertical in order to facilitate the other manipulations I need to do. For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Structure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X X X X Y Y Y Y Z Z Z Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want =&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im using this code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data all.ap5;&lt;BR /&gt;set all.stage9;&lt;BR /&gt;array vars{900} VAR11_c1-VAR11_c900;&lt;BR /&gt;array vars1{900} VAR25_c1-VAR25_c900;&lt;BR /&gt;array vars2{900} VAR34_c1-VAR34_c900;&lt;BR /&gt;obs = _n_;&lt;BR /&gt;do i = 1 to 900;&lt;BR /&gt;var11 = vars{i};&lt;BR /&gt;if not missing(var11) then output all.ap5;&lt;BR /&gt;end;&lt;BR /&gt;do i = 1 to 900;&lt;BR /&gt;var25 = vars1{i};&lt;BR /&gt;if not missing(var25) then output all.ap5;&lt;BR /&gt;end;&lt;BR /&gt;do i = 1 to 900;&lt;BR /&gt;var34 = vars2{i};&lt;BR /&gt;if not missing(var34) then output all.ap5;&lt;BR /&gt;end;&lt;BR /&gt;drop i var8_c1-var8_c1260 VAR11_c1-VAR11_c1260 VAR12_c1-VAR12_c1260 Participant__Nation_c1-Participant__Nation_c1260&lt;BR /&gt;var25_c1-var25_c1260 var26_c1-var26_c1260 VAR32_c1-VAR32_c1260 VAR34_c1-VAR34_c1260 VAR35_c1-VAR35_c1260&lt;BR /&gt;VAR36_c1-VAR36_c1260 VAR37_c1-VAR37_c1260 VAR50_c1-VAR50_c1260 VAR54_c1-VAR54_c1260 VAR55_c1-VAR55_c1260&lt;BR /&gt;VAR61_c1-VAR61_c1260;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What it gives me is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&amp;nbsp;&lt;/P&gt;&lt;P&gt;X&lt;/P&gt;&lt;P&gt;X &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Y&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Y&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Y&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Y&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Z&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Z&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Z&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I edit the code to get what I need?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 18:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333868#M9844</guid>
      <dc:creator>r4321</dc:creator>
      <dc:date>2017-02-17T18:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333895#M9845</link>
      <description>&lt;P&gt;I think you were pretty close if I understand your goal. Look at this:&lt;/P&gt;
&lt;PRE&gt;data all.ap5;
   set all.stage9;
   array vars{900} VAR11_c1-VAR11_c900;
   array vars1{900} VAR25_c1-VAR25_c900;
   array vars2{900} VAR34_c1-VAR34_c900;
   obs = _n_;
   do i = 1 to 900;
      var11 = vars{i};
      var25 = vars1{i};
      var34 = vars2{i};
      output all.ap5;
   end;
   drop i var8_c1-var8_c1260 VAR11_c1-VAR11_c1260 VAR12_c1-VAR12_c1260 Participant__Nation_c1-Participant__Nation_c1260
   var25_c1-var25_c1260 var26_c1-var26_c1260 VAR32_c1-VAR32_c1260 VAR34_c1-VAR34_c1260 VAR35_c1-VAR35_c1260
   VAR36_c1-VAR36_c1260 VAR37_c1-VAR37_c1260 VAR50_c1-VAR50_c1260 VAR54_c1-VAR54_c1260 VAR55_c1-VAR55_c1260
   VAR61_c1-VAR61_c1260;
run;&lt;/PRE&gt;
&lt;P&gt;Note that it is a good idea to post code and log results&amp;nbsp;in a code box opened with the {i} menu icon to prevent the message window from reformatting when pasted here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The numbers of variables in your data set is somewhat troubling to me. That is a LOT of variables.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 19:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333895#M9845</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-17T19:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333910#M9846</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;HAVE

Middle Observation(15 ) of Last dataset = WORK.HAVE - Total Obs 31

1260*3 = 3780 variables

 -- NUMERIC --             VALUE

VAR11_C1        N    8       50
VAR11_C2        N    8       846
VAR11_C3        N    8       671
VAR11_C4        N    8       832
VAR11_C5        N    8       598
VAR11_C6        N    8       96
VAR11_C7        N    8       883
VAR11_C8        N    8       553
VAR11_C9        N    8       679
....
VAR11_C1260     N    8       294
VAR25_C1        N    8       105
VAR25_C2        N    8       934
VAR25_C3        N    8       783
VAR25_C4        N    8       876
'''
VAR25_C1259     N    8       774
VAR25_C1260     N    8       409
VAR34_C1        N    8       408
VAR34_C2        N    8       468
VAR34_C3        N    8       16
VAR34_C4        N    8       455
...
VAR34_C1259     N    8       827
VAR34_C1260     N    8       83

WANT

p to 40 obs WORK.WANT total obs=39,060

 Obs   REC  VAR11    VAR25  VAR34

   1     1     20      578    393
   2     1    613      704    928
   3     1    813      125    369
   4     1    492      514    301
   5     1    802       34    703
   6     1    218      338    986
   7     1    839      114    283
   8     1    549       73     89
   9     1    748      620    457

WORKING CODE

   data want1(keep=rec var11) want2(keep=var25) want3(keep=var34);

   merge want1 want2 want3;
   * no by;

FULL SOLUTION&lt;BR /&gt;=============&lt;BR /&gt;
libname sd1 "d:/sd1";
libname wrk "%sysfunc(pathname(work))";
data have;
* create some data;
array vars{1260} VAR11_c1-VAR11_c1260;
array vars1{1260} VAR25_c1-VAR25_c1260;
array vars2{1260} VAR34_c1-VAR34_c1260;
do rec=1 to 30;
  do i=1 to 1260;
    vars[i]=int(1000*uniform(5731));
    vars1[i]=int(1000*uniform(5731));
    vars2[i]=int(1000*uniform(5731));
  end;
  drop i rec;
  output;
end;
output;
run;quit;
data want1(keep=rec var11) want2(keep=var25) want3(keep=var34);
retain rec;
set  have;
array vars{1260} VAR11_c1-VAR11_c1260;
array vars1{1260} VAR25_c1-VAR25_c1260;
array vars2{1260} VAR34_c1-VAR34_c1260;
rec = _n_;
do i = 1 to 1260;
var11 = vars{i};
output want1;
end;
do i = 1 to 1260;
var25 = vars1{i};
output want2;
end;
do i = 1 to 1260;
var34 = vars2{i};
output want3;
end;
drop i
 VAR11_C1-VAR11_C1260
 VAR25_C1-VAR25_C1260
 VAR34_C1-VAR34_C1260;
run;
data wrk.want;
  merge want1 want2 want3;
  * no by;
  if sum(var11,var25,var34)=0 then delete;
run;quit;

proc print data=want;
run;quit;

Obs    REC    VAR11    VAR25    VAR34

  1     1       20      578      393
  2     1      613      704      928
  3     1      813      125      369
  4     1      492      514      301
  5     1      802       34      703
  6     1      218      338      986
  7     1      839      114      283
  8     1      549       73       89
  9     1      748      620      457

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Feb 2017 19:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333910#M9846</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-02-17T19:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333976#M9847</link>
      <description>&lt;P&gt;And then there's always good old PROC TRANSPOSE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work.have &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;=work.Inter1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; VAR11_c1-VAR11_c900 VAR25_c1-VAR25_c900 VAR34_c1-VAR34_c900;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Inter1(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ColClass $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Inter1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;ColClass = substr(_NAME_, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&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;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work.Inter1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ColClass;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&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;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work.Inter1 &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;=Inter2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ColClass;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; Col1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&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;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work.Inter2(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=_NAME_) &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;=Want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 21:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333976#M9847</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2017-02-17T21:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333991#M9849</link>
      <description>&lt;P&gt;Ballard,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data all.ap5;
   set all.stage9;
   array vars{900} VAR11_c1-VAR11_c900;
   array vars1{900} VAR25_c1-VAR25_c900;
   array vars2{900} VAR34_c1-VAR34_c900;
   obs = _n_;
   do i = 1 to 900;
      var11 = vars{i};
      var25 = vars1{i};
      var34 = vars2{i};
      output all.ap5;
   end;
   drop i var8_c1-var8_c1260 VAR11_c1-VAR11_c1260 VAR12_c1-VAR12_c1260 Participant__Nation_c1-Participant__Nation_c1260
   var25_c1-var25_c1260 var26_c1-var26_c1260 VAR32_c1-VAR32_c1260 VAR34_c1-VAR34_c1260 VAR35_c1-VAR35_c1260
   VAR36_c1-VAR36_c1260 VAR37_c1-VAR37_c1260 VAR50_c1-VAR50_c1260 VAR54_c1-VAR54_c1260 VAR55_c1-VAR55_c1260
   VAR61_c1-VAR61_c1260;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this. However, the 'if not missing' part is critical to my code - is there a way to incorporate this in the code you offered?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 23:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/333991#M9849</guid>
      <dc:creator>r4321</dc:creator>
      <dc:date>2017-02-17T23:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334006#M9852</link>
      <description>&lt;P&gt;I don't know your logic so you'll have to incorporate but if you require ALL of the variables to be not missing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if nmiss(var11,var25,var34) = 0 then output;&lt;/P&gt;
&lt;P&gt;may be one way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previously you were looking at individual values so&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 23:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334006#M9852</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-17T23:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334014#M9854</link>
      <description>Okay I tried..&lt;BR /&gt;&lt;BR /&gt;data all.ap5;&lt;BR /&gt;set all.stage9;&lt;BR /&gt;array vars{900} VAR11_c1-VAR11_c900;&lt;BR /&gt;array vars1{900} VAR25_c1-VAR25_c900;&lt;BR /&gt;array vars2{900} VAR34_c1-VAR34_c900;&lt;BR /&gt;obs = _n_;&lt;BR /&gt;do i = 1 to 900;&lt;BR /&gt;var11 = vars{i};&lt;BR /&gt;var25 = vars1{i};&lt;BR /&gt;var34 = vars2{i};&lt;BR /&gt;if nmiss(var11,var25,var34) = 0 thenoutput all.ap5;&lt;BR /&gt;end;&lt;BR /&gt;drop i var8_c1-var8_c1260 VAR11_c1-VAR11_c1260 VAR12_c1-VAR12_c1260 Participant__Nation_c1-Participant__Nation_c1260&lt;BR /&gt;var25_c1-var25_c1260 var26_c1-var26_c1260 VAR32_c1-VAR32_c1260 VAR34_c1-VAR34_c1260 VAR35_c1-VAR35_c1260&lt;BR /&gt;VAR36_c1-VAR36_c1260 VAR37_c1-VAR37_c1260 VAR50_c1-VAR50_c1260 VAR54_c1-VAR54_c1260 VAR55_c1-VAR55_c1260&lt;BR /&gt;VAR61_c1-VAR61_c1260;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Unfortunately, that doesn't work. The three variables are character variables with a either a "Yes" or "No" in them (or blank, that's why I need to drop the missings).</description>
      <pubDate>Sat, 18 Feb 2017 01:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334014#M9854</guid>
      <dc:creator>r4321</dc:creator>
      <dc:date>2017-02-18T01:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334033#M9855</link>
      <description>&lt;P&gt;It is very easy for IML code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (v1-v12) ($);
cards;
X X X X Y Y Y Y Z Z Z Z 
;
run;
proc iml;
use have;
read all var _all_ into x;
close;
want=shapecol(x,0,3);
create want from want;
append from want;
close;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 06:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334033#M9855</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-18T06:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334118#M9857</link>
      <description>&lt;P&gt;Thanks guys - I've tried various versions of the code everyone has given me, but it's still not quite what I need. Perhaps it's because I'm not very advanced with SAS, but let me reiterate what I'm looking for because I must've not explained well. My data structure is like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X . . . X X Y . Y Y . . Z . . Z Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need it to be like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;X &amp;nbsp;Y &amp;nbsp;Z&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I use this code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data all.ap5;
set all.stage9;
array vars{900} VAR11_c1-VAR11_c900;
obs = _n_; 
do i = 1 to 900;
	var11 = vars{i};
	if not missing(var11) then output all.ap5;
	end;
drop i var8_c1-var8_c1260 VAR11_c1-VAR11_c1260 VAR12_c1-VAR12_c1260 Participant__Nation_c1-Participant__Nation_c1260
var25_c1-var25_c1260 var26_c1-var26_c1260 VAR32_c1-VAR32_c1260 VAR34_c1-VAR34_c1260 VAR35_c1-VAR35_c1260
VAR36_c1-VAR36_c1260 VAR37_c1-VAR37_c1260  VAR50_c1-VAR50_c1260 VAR54_c1-VAR54_c1260 VAR55_c1-VAR55_c1260 
VAR61_c1-VAR61_c1260;
run;

&lt;/PRE&gt;&lt;P&gt;It gives me exactly what I need. However, instead of doing it for just one variable. I want to do it for the three variables at the same time, so I tried something like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data all.test;
set all.stage8;
array vars{1440} VAR55_c1-VAR55_c1440;
array vars1{1440} VAR61_c1-VAR61_c1440;
obs = _n_; 
do i = 1 to 1440;
	var55 = vars{i};
	if not missing(var55) then output all.test;
	end;
do i = 1 to 1440;
	var61 = vars1{i};
	if not missing(var61) then output all.test;
	end;
drop i VAR55_c1-VAR55_c1440 VAR61_c1-VAR61_c1440;
run;&lt;/PRE&gt;&lt;P&gt;However, that does not work how I need it to..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If someone could point me in the right direction that would be great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variables I'm arraying are character variables with either a "Yes" or "No" as their values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;R&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 19:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334118#M9857</guid>
      <dc:creator>r4321</dc:creator>
      <dc:date>2017-02-18T19:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to array variables longways side by side</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334128#M9858</link>
      <description>&lt;P&gt;Finally figured it out. Thanks guys - I used rogerjdean's code and added &amp;nbsp;'if not missing(var) then' before each output. Thanks for your patience.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 20:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/how-to-array-variables-longways-side-by-side/m-p/334128#M9858</guid>
      <dc:creator>r4321</dc:creator>
      <dc:date>2017-02-18T20:40:22Z</dc:date>
    </item>
  </channel>
</rss>

