DATA Step, Macro, Functions and more

SAS SQL Code for Appending two tables

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

SAS SQL Code for Appending two tables

I have two tables- have1 and have 2 and would like to append them. Basically keep observations from both tables and sort them first based on ID and second based on YEAR. Do you guys know the SAS SQL code for this append/merge? I prefer SQL and not data step code. Thanks.

Have1  
IDStateYEAR
1AR1989
1AR1990
1AR1991
1AR1992
1AR1993
1AR1994
2OK1995
2OK1996
2OK1997
2OK1998

 

Have2  
IDStateYEAR
1CA1999
1CA2000
1CA2001
1CA2002
1CA2003
2NV1999
2NV2000
2NV2001
2NV2002
2NV

2003

 

Want   
IDStateYEAR
1AR1989
1AR1990
1AR1991
1AR1992
1AR1993
1AR1994
1CA1999
1CA2000
1CA2001
1CA2002
1CA2003
2OK1995
2OK1996
2OK1997
2OK1998
2NV1999
2NV2000
2NV2001
2NV2002
2NV2003

Accepted Solutions
Solution
‎11-26-2016 03:01 PM
Super User
Posts: 17,784

Re: SAS SQL Code for Appending two tables


All Replies
Solution
‎11-26-2016 03:01 PM
Super User
Posts: 17,784

Re: SAS SQL Code for Appending two tables

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 168 views
  • 0 likes
  • 2 in conversation