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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.