Search code examples
mergesasrow

How to make row bind with more than 2 tables using prosql in SAS


I have multiple tables like Table1 Table2 Table3, Table4 They have the same columns in the same order. I want to bind them vertically I have no idea of how to make it. I tried this code:

PROC SQL; 

    create table Table_final AS

    ( 

    select * from Table1 

    union all

    select * Table2 
    
    union all

    select * Table3 
  
    union all

    select * Table4 

    ); 

    QUIT;

But it doesn't work


Solution

  • Glad you solved the problem by yourself in an alternate way. However you made few syntax errors by ignoring FROM statement on your query.

    Here is your updated code:

    PROC SQL; 
    create table Table_final AS
     ( 
        select * from Table1 
        union all
        select * from Table2     
        union all
        select * from Table3   
        union all
        select * from Table4 
     ); 
    QUIT;
    

    This worked for me.