2013-05-22 81 views
3

假設我有一個表SAS PROC SQL把2列到1列

A  | B 
=============== 
Dan | Jack 
April | Lois 
Matt | Davie 
Andrew | Sally 

,我想打一個表

C  
====== 
Dan 
April 
Matt 
Andrew 
Jack 
Lois 
Davie 
Sally 

使用SAS proc sql。我怎樣才能做到這一點?

回答

4
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; 
4

我知道你問了proc sql,但這裏是你如何使用數據步驟。我認爲這很容易:

data table2(keep=c); 
    set table1; 
    c = a; 
    output; 
    c = b; 
    output; 
run; 
0
proc sql; 
    create table combine as 
    select name 
    from one 
    union 
    select name 
    from two; 
quit;