BookmarkSubscribeRSS Feed
IgorR
Quartz | Level 8

Hi!

I have a SAS project that has multiple programs in single Process Flow.

One of programs include multiple SQL queries, when every query is in separate Proc SQL, like this example:

/* Merge data from Tables */
Proc SQL; Create Table A As Select * From TableA; Quit; Proc SQL; Create Table B As Select * From TableB; Quit; Proc SQL; Create Table Merged As Select A.*, B.* From A Inner Join B On A.ID = B.ID; Quit;

The problem is that when I run the whole program, the table A is empty and Table B has values.

But if I run Proc SQL for table A only I do receive table A with values.

What could be a problem?

2 REPLIES 2
ballardw
Super User

Show us the log with all the code and all messages.

Show the code where you "run Proc SQL for table A only I do receive table A with values." from the log.

 

One suspects that you are doing something that part way through the code you reuse A as a table name incorrectly.

 

Or are looking at the wrong data set. Your table Merged would be empty if none of the ID values in A match any in B.

andreas_lds
Jade | Level 19

Hardly possible to help without seeing the log posted as text using the insert code button </>

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 561 views
  • 0 likes
  • 3 in conversation