What is the purpose of resetting temporary variables many1 and many2 in following code.
data pairs oddballs; many1=0; many2=0; merge many1 ( in = many1 ) many2 ( in = many2 ); by partkey; if many1 and many2 then output pairs; else output oddballs; run;
This type of code is used for many-to-many matches. For example, let's say:
That's what this program accomplishes ... matching based on whichever data set has fewer observations, and putting those matched observations into PAIRS. Discarding any that are left over without a match, putting them into ODDBALLS.
No practical purpose served that I can tell. If you found this code somewhere the assignments might be an artifact left in from previous code tested.
Or someone misunderstanding how temporary variables work in SAS.
This type of code is used for many-to-many matches. For example, let's say:
That's what this program accomplishes ... matching based on whichever data set has fewer observations, and putting those matched observations into PAIRS. Discarding any that are left over without a match, putting them into ODDBALLS.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.