SAS/SQL

Hi,

I want to change the following SQL-code with 2 input-tables to a SQL-code with 3 input-tables.
PROC SQL;
    CREATE TABLE outp AS      
    SELECT A.*, B.*
        FROM inp1 A INNER JOIN inp2 B
        ON A.key = B.key ;
QUIT ;

How can i do that.

Tx
sonmicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bradanelsonCommented:
Depends.  There are many ways to introduce a 3rd table.  It all depends on how you want to join the table.  Here is a basic example of what I'm talking about.  This example joins inp3 buy INNER JOIN to inp2.  Like I said, there are many other ways to join that will give you different results.  For instance you can do a LEFT JOIN as well.

PROC SQL;
    CREATE TABLE outp AS      
    SELECT A.*, B.*
        FROM inp1 A

        INNER JOIN inp2 B
        ON A.key = B.key

        INNER JOIN inp3 C
        ON B.key=C.key;
QUIT ;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bradanelsonCommented:
To select fields from inp3 you need to add to the SELECT statement.

PROC SQL;
    CREATE TABLE outp AS      
    SELECT A.*, B.*. C.*
        FROM inp1 A

        INNER JOIN inp2 B
        ON A.key = B.key

        INNER JOIN inp3 C
        ON B.key=C.key;
QUIT ;


Good Luck
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.