data have;
input A $ B $;
datalines;
Dan Jack
April Lois
Matt Davie
Andrew Sally
;
run;
proc sql;
create table want as
select A as name from have
union all
select B as name from have;
quit;
SAS proc sql to turn 2 columns into 1 column
Вопрос
Suppose I have a table
A | B
===============
Dan | Jack
April | Lois
Matt | Davie
Andrew | Sally
and I want to make a table
C
======
Dan
April
Matt
Andrew
Jack
Lois
Davie
Sally
using SAS proc sql
. How can I do that?
Решение
Другие советы
I know you asked for proc sql, but here's how you would do it with a data step. I think it's easier:
data table2(keep=c);
set table1;
c = a;
output;
c = b;
output;
run;
proc sql;
create table combine as
select name
from one
union
select name
from two;
quit;
Не связан с StackOverflow