We help IT Professionals succeed at work.
Get Started

How do I find the distribution of common values between 2 datasets?

SASnewbie asked
Last Modified: 2014-10-03

I have 2 datasets (1 & 2) that have 4 variables in common (A, B. C, D). How do I find the frequency (or count) of the common values found in both datasets?

Variable A is the merge by variable.

For example:
Variable B has 50 records containing one of these values (10, 15, 25, 45...)

Variable B has 150 records containing one of these values (10, 15, 25, 45, 65 80...)

How can I produce an output like this?

Frequency of common values between dataset1 and dataset2:

Value    Dataset1 Freq       Dataset2 Freq   Common Freq     % of Total      Total (combined)
    10               75                                80                        50                25.0%                 200
    15               25                                40                        25                12.5%                 200
    25               50                                80                        10                   5.0%                200

And so on for Variables C and D...
Thanks in advance
Watch Question
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE