<?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: Put all the rows in a table in a single column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509719#M137073</link>
    <description>&lt;P&gt;Not important at all.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Nov 2018 22:24:22 GMT</pubDate>
    <dc:creator>Datino</dc:creator>
    <dc:date>2018-11-01T22:24:22Z</dc:date>
    <item>
      <title>Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509708#M137064</link>
      <description>&lt;P&gt;I have the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
infile datalines dlm=',' dsd;
   input fruit:$32. veg:$32. num:32.
;
   datalines; 
apple, potato, 30
banana, celery, 50
berry, zucchini, 40
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can I append all the columns into a single one so that I get something like this? (I'm aware one column is numeric and would be converted to char)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var&lt;/P&gt;&lt;P&gt;apple&lt;/P&gt;&lt;P&gt;banana&lt;/P&gt;&lt;P&gt;berry&lt;/P&gt;&lt;P&gt;potato&lt;/P&gt;&lt;P&gt;celery&lt;/P&gt;&lt;P&gt;zucchini&lt;/P&gt;&lt;P&gt;30&lt;/P&gt;&lt;P&gt;50&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509708#M137064</guid>
      <dc:creator>Datino</dc:creator>
      <dc:date>2018-11-01T22:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509709#M137065</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have; 
infile datalines dlm=',' dsd;
   input fruit:$32. veg:$32. num:32.
;
   datalines; 
apple, potato, 30
banana, celery, 50
berry, zucchini, 40
;
run;

proc transpose data=have out=w(keep=col1);
by _all_;
var _all_;
run;

/*for alignement correction*/

data want;
set w;
want=left(col1);
drop col1;
run;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;EDIT: The above will produce a auto-conversion note in the log&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 21:55:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509709#M137065</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-01T21:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509711#M137067</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*cleaner method*/

data _have;
set have;
char=put(num,8. -l);
drop num;
run;

proc transpose data=_have out=want(keep=  col1);
by _all_;
var _all_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2018 21:59:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509711#M137067</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-01T21:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509714#M137069</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123840"&gt;@Datino&lt;/a&gt;&amp;nbsp; I like this as best imho&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
set have;
temp=catx(' ',fruit,veg,num);
do _n_=1 to countw(temp,' ');
want=scan(temp,_n_,' ');
output;
end;
keep want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to add a length statement for temp like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Length temo $50;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at the top&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509714#M137069</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-01T22:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509716#M137070</link>
      <description>&lt;P&gt;Is the output order important, critical or not?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509716#M137070</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-01T22:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509719#M137073</link>
      <description>&lt;P&gt;Not important at all.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509719#M137073</guid>
      <dc:creator>Datino</dc:creator>
      <dc:date>2018-11-01T22:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509720#M137074</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;,, you are right to make meaningful grouping as--&amp;gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set have end=lr;
if _n_=1 then do;
   dcl hash H (ordered: "A", multidata:'y') ;
   h.definekey  ("vn") ;
   h.definedata ("vn","want") ;
   h.definedone () ;
end;
array t(*) fruit veg;
do i= 1 to 2;
vn=vname(t(I));
want=t(I);
h.add();
end;
want=put(num,8. -l);
vn='num';
h.add();
if lr then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509720#M137074</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-01T22:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509725#M137079</link>
      <description>Data onecolumn ;&lt;BR /&gt;Length item $50 ;&lt;BR /&gt;INFILE "your data" TRUNCOVER lrecl= 32760 dad;&lt;BR /&gt;Input item @@;&lt;BR /&gt;Run;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Nov 2018 22:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509725#M137079</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-01T22:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509726#M137080</link>
      <description>D*** autocorrect&lt;BR /&gt;For DAD read  DSD</description>
      <pubDate>Thu, 01 Nov 2018 22:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509726#M137080</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-01T22:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509729#M137081</link>
      <description>More code could be added :&lt;BR /&gt;If the column number is needed&lt;BR /&gt;If numeric validation is needed for column3&lt;BR /&gt;If columns might be empty&lt;BR /&gt;If columns after the third should be ignored&lt;BR /&gt;&lt;BR /&gt;However, it shouldn't need much more than the code above&lt;BR /&gt;(might need to use FLOWOVER rather than TRUNCOVER)</description>
      <pubDate>Thu, 01 Nov 2018 23:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509729#M137081</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-01T23:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509845#M137118</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
infile datalines dlm=',' dsd;
   input fruit:$32. veg:$32. num:32.
;
   datalines; 
apple, potato, 30
banana, celery, 50
berry, zucchini, 40
;
run;

proc sql;
create table want as
select fruit from have
union all
select veg from have
union all
select put(num,best. -l) from have;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Nov 2018 13:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509845#M137118</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-02T13:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Put all the rows in a table in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509901#M137143</link>
      <description>Would this work as a single pass of WANT if the data step created it as a VIEW?</description>
      <pubDate>Fri, 02 Nov 2018 15:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-all-the-rows-in-a-table-in-a-single-column/m-p/509901#M137143</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-02T15:06:30Z</dc:date>
    </item>
  </channel>
</rss>

