<?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 Unique Transpose Question? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388957#M277455</link>
    <description>&lt;P&gt;I have a summarized data set where the first column has fewer unique values than the second column. I want to be able to transpose the dataset such that the unique values of Column A become a new variable and every corresponding value in column B goes under it. Here's an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var1&amp;nbsp;Var 2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;z&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;r&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Becomes:&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;2&lt;/P&gt;&lt;P&gt;x &amp;nbsp;q&lt;/P&gt;&lt;P&gt;y &amp;nbsp;r&lt;/P&gt;&lt;P&gt;z &amp;nbsp;s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc transpose doesn't seem to be the right solution to this, does anyone have an idea of how I can tackle this? Also the number of unique variables from Var1 are dynamic (doing this multiple times) so manually summarizing by every unqiue varaible in var one and then stacking them together isn't very efficient&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2017 20:29:22 GMT</pubDate>
    <dc:creator>MountainDew123</dc:creator>
    <dc:date>2017-08-17T20:29:22Z</dc:date>
    <item>
      <title>Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388957#M277455</link>
      <description>&lt;P&gt;I have a summarized data set where the first column has fewer unique values than the second column. I want to be able to transpose the dataset such that the unique values of Column A become a new variable and every corresponding value in column B goes under it. Here's an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var1&amp;nbsp;Var 2&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;z&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;q&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;r&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Becomes:&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;2&lt;/P&gt;&lt;P&gt;x &amp;nbsp;q&lt;/P&gt;&lt;P&gt;y &amp;nbsp;r&lt;/P&gt;&lt;P&gt;z &amp;nbsp;s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc transpose doesn't seem to be the right solution to this, does anyone have an idea of how I can tackle this? Also the number of unique variables from Var1 are dynamic (doing this multiple times) so manually summarizing by every unqiue varaible in var one and then stacking them together isn't very efficient&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 20:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388957#M277455</guid>
      <dc:creator>MountainDew123</dc:creator>
      <dc:date>2017-08-17T20:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388959#M277456</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by var2; run;&lt;BR /&gt;proc transpose data=have out=want;
  by var2;
  var var1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 20:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388959#M277456</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-08-17T20:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388967#M277457</link>
      <description>&lt;P&gt;Clearly, VAR1 will have to be character, in order for this to happen.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can&amp;nbsp;you describe the data a bit:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Maximum number of VAR1 values you might find in your data&lt;/LI&gt;
&lt;LI&gt;Similarly,&amp;nbsp;maximum number of VAR2 values&lt;/LI&gt;
&lt;LI&gt;Maximum size of&amp;nbsp;a VAR2 value (number of characters)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I'm thinking it might be possible to load the entire data set into memory at once, but your answers will help determine that.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 20:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388967#M277457</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-17T20:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388971#M277458</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159519"&gt;@MountainDew123&lt;/a&gt;&amp;nbsp; Hi, It's a very interesting question and I am little stumped to make it elegant as my brain isn't working the best perhaps because of too much of coffee. I will await for super elegant solution from a super user like you. However, here is my ugly yet working solution for the time being:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input (Var1 Var2) ($);&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; q&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* I split into multiple datasets in this step*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;declare hash myhash(multidata:'y');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = myhash.defineKey('var1');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = myhash.defineData('var1','need');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = myhash.defineDone( );&lt;/P&gt;&lt;P&gt;do until(last.var1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by var1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.var1 then&lt;/P&gt;&lt;P&gt;&amp;nbsp; do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myhash.clear();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; need=var1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myhash.add();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; need=var2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; myhash.add();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; need=var2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; myhash.add();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.var1 then&amp;nbsp; myhash.output(dataset:cats('var',var1));&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/*I combine the datasets obtained in the previous step to get your WANT*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set var1(rename=(need=need1));&lt;/P&gt;&lt;P&gt;set var2(rename=(need=need2));&lt;/P&gt;&lt;P&gt;drop var1;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen Srinivasan&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 21:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388971#M277458</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-17T21:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388976#M277459</link>
      <description>&lt;P&gt;PROC TRANSPOSE but you first have to add a counter. It seems like the 'easiest' approach in terms of understanding the process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;

input Var1 Var2 $ ;
cards;
1        x
1        y
1        z
2        q
2        r
2        s
;
run;

data have2;
set have;
by var1;
if first.var1 then count=1;
else count+1;
run;

proc sort data=have2;
by count;
run;

proc transpose data=have2 out=want prefix=want;
by count;
var var2;
id var1;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2017 22:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388976#M277459</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-17T22:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388977#M277460</link>
      <description>&lt;P&gt;There is probably a less convoluted way to do this (assuming I correctly understand what you want) but, if it is what you want, here is one way to do it:&lt;/P&gt;
&lt;PRE&gt;data have;
  input Var1 Var2 $;
  cards;
1        x
1        y
1        z
2        q
2        r
2        s
;

proc sql noprint;
  select min(var1) into :minv
    from have
  ;
  
  select n(var1)
    into :obs
      from have
        where Var1 eq &amp;amp;minv.
  ;
quit;

data need;
  set have;
  _obs=ifn(mod(_n_,&amp;amp;obs.) gt 0,mod(_n_,&amp;amp;obs.),&amp;amp;obs.);
run;

proc sort data=need;
 by _obs;
run;

options validvarname=any;
proc transpose data=need out=want (drop=_:);
  by _obs;
  var var2;
  id var1;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2017 22:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/388977#M277460</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-17T22:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389028#M277461</link>
      <description>&lt;P&gt;Assuming you want to pair values based on their order:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Var1 Var2 $;
datalines;
1        x
1        y
1        z
2        q
2        r
2        s
;

data temp;
set have; by var1;
if first.var1 then order = 0;
order + 1;
run;

proc sort data=temp; by order var1; run;

proc transpose data=temp out=want(drop=_name_ order) prefix=_;
by order;
id var1;
idlabel var1;
var var2;
run;

proc print noobs label;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 03:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389028#M277461</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-08-18T03:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389110#M277462</link>
      <description>&lt;PRE&gt;
Double proc transpose can do that .


data have;
input Var1 Var2 $;
datalines;
1        x
1        y
1        z
2        q
2        r
2        s
;

proc transpose data=have out=temp;
by var1;
var var2;
run;
proc transpose data=temp out=want;
id var1;
var col:;
run;



OR Merge Skill.


proc sql;
select distinct catt('have(where=(var1=',var1,') rename=(var2=_',var1,'))')
 into : list separated by ' '
  from have;
quit;

data want2;
 merge &amp;amp;list;
 drop var1;
run;

&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Aug 2017 13:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389110#M277462</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-18T13:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389124#M277463</link>
      <description>&lt;P&gt;I definitely like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;'s double transpose solution more than the code I suggested and, if you really want the resulting variables to be named 1 and 2, you'd just have to insert:&lt;/P&gt;
&lt;PRE&gt;options validvarname=any;&lt;/PRE&gt;
&lt;P&gt;before the second proc transpose&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2017 15:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389124#M277463</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-18T15:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389490#M277464</link>
      <description>&lt;P&gt;Var 1 will be no more than 12 possible values with length between 3-30 and var 2 across all of var 1's will probably be no more than 25-30 with a consistent length of about 5.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 11:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389490#M277464</guid>
      <dc:creator>MountainDew123</dc:creator>
      <dc:date>2017-08-21T11:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389493#M277465</link>
      <description>&lt;P&gt;Why did you make the first observations have col1='x' and col2='q'? &amp;nbsp;Do you want to just align the values by their order in the original dataset? &amp;nbsp;If so you need a new variable to use proc transpose.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data middle ;
  set have ;
  by var1;
  row+1;
  if first.var1 then row=1;
run;
proc sort;
  by row var1 ;
run;
proc tranpose data=middle out=want ;
  by row ;
  id var1;
  var var2;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Aug 2017 12:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389493#M277465</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-21T12:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389494#M277466</link>
      <description>&lt;P&gt;That's a relatively small number of values. &amp;nbsp;I'm inclined to load them all into memory in the right order:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data halfway_there;&lt;/P&gt;
&lt;P&gt;array allvals&amp;nbsp;{12, 30} $ 32;&lt;/P&gt;
&lt;P&gt;do until (done);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set have end=done;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by val1 notsorted;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if first.var1 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; col + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; row=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; vals{row, col} = var1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;row + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;vals{row, col} = var2;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;call symputx('nrows', row);&lt;/P&gt;
&lt;P&gt;call symputx('ncols', col);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That much gives you a two-dimensional array with all the values in the "right" places. &amp;nbsp;In addition, the final value of ROW and COL tell you how much of the array is actually filled. &amp;nbsp;So the DATA step captures how many rows and columns were actually needed. &amp;nbsp;That's the CALL SYMPUTX part (which relies on the data being consistent ... same number of rows for every column).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the number of required rows and columns known, a second DATA step could "unpack" the array:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set halfway_there;&lt;/P&gt;
&lt;P&gt;length var1-var&amp;amp;ncols $ 32;&lt;/P&gt;
&lt;P&gt;array var {&amp;amp;ncols};&lt;/P&gt;
&lt;P&gt;keep var1-var&amp;amp;ncols;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array&amp;nbsp;&lt;/SPAN&gt;allvals&lt;SPAN&gt;&amp;nbsp;{12, 30};&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;do row=1 to &amp;amp;nrows;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;do col=1 to &amp;amp;ncols;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; var{col} = allvals{row, col};&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;output;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is untested, so might need to be tweaked. &amp;nbsp;But it's definitely a viable approach.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 12:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389494#M277466</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-21T12:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Transpose Question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389598#M277467</link>
      <description>&lt;P&gt;Worked like a charm thanks a ton&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 18:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-Transpose-Question/m-p/389598#M277467</guid>
      <dc:creator>MountainDew123</dc:creator>
      <dc:date>2017-08-21T18:01:10Z</dc:date>
    </item>
  </channel>
</rss>

