proc sql;
create table Btable
as select
id,
name,
dob
FROM table1
UNION
SELECT
id,
name,
dob
FROM table2
where id IN ('12345' '123456');
quit;
I have tried everything to filter on these two ID's but i keep getting errors. I tried separating with a comma, semicolon - nothing seems to work.
Is ID a numeric variable or a character variable? Does it have a format attached to it? Which format? Is it a SAS system format or a user defined format. Remember you need to test for the actual values, not the values are displayed by the format.
Why are you filtering on just one of the two tables you are combining?
There is no obvious syntax error in your posted code. You need to post your complete SAS log including notes and errors so we can see what is happening.
Please post the complete log of your SQL step by cppy/pasting it into a window opened with this button:
AS an absolute minimum include the actual text of any errors. Much better is to show the entire log for the procedure run with the code and all notes, warnings or errors associated with that procedure. Copy the text from the LOG, on the forum open a text box using the </> icon above the message window and paste the copied text.
Is it as simple as your ID variable is numeric and you are getting errors about the wrong type such as
ERROR: Expression using IN has components that are of different data types.
Then don't put quotes around the values.
Is ID a numeric variable or a character variable? Does it have a format attached to it? Which format? Is it a SAS system format or a user defined format. Remember you need to test for the actual values, not the values are displayed by the format.
Why are you filtering on just one of the two tables you are combining?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: