BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Agent1592
Pyrite | Level 9

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
1 ACCEPTED SOLUTION
1 REPLY 1

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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