Pergunta

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?

Foi útil?

Solução

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;

Outras dicas

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;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top