Can you provide some example data of table1?
And now...paste in a self-contained SAS datastep using datalines for your data, so we don't have to do the work that you should provide.
Paste examples of your source datasets (traditionally called "have", or in your case "have1", "have2") and your target dataset (traditionally called "want"). Although we should be able to figure source(s) and target(s) from the context, so the above dataset names, while helpful, are optional.
Please also paste your code inside a SAS block - click the "running man" icon in the editor to do so.
This looks like a work of a database trigger.
1. So what do you do when a particular record is removed from table 2?
2. You still have not mentioned about the conditions for flag variables, are all 14 variables dependent on one record in table 2?
Please post data with data lines, so that we don't have to construct the data.
And show us with example how the output should look like for your input.
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.