This depends on the data, so we need to know that.
Please supply examples of your datasets (that show the issue) in usable form (data steps with datalines). Please use the "little running man" button to post SAS code.
Hi @ywon111
Please post a sample of your data in regular datalines.
When you look further at the output containing the multiples rows, which condition is not satisfied?
Best,
Define clearly what is wrong with the result.
Best is with small example data sets.
If your T2 data set has multiple values of userid then it is very likely you would get some "multiple rows". Not so much the multiple conditions or brackets.
Consider this very small example. Note use of data step to provide example data and posting in a code box opened with the </> icon.
data example1; input id value; datalines; 1 5 2 4 3 9 ; data example2; input id otherval; datalines; 1 27 1 18 5 99 ; proc sql; create table exampleout as select a.*, b.otherval from example1 as a left join example2 as b on a.id=b.id ; quit;
This is small enough you can quickly see the "multiple rows" are coming from duplicate ID in the second data set. That is what a Left Join does when there are multiple values in the second set. The exercise for an interested reader is to modify the Example1 data set to have 2 Id values of 1 and see the result as well.
The code boxes will keep the message windows from reformatting text. Also sometimes the main message window can cause issues with copying code from the forum that won't run because of changed positions of characters when reading data.
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 25. Read more here about why you should contribute and what is in it for you!
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.