Hi,
I am working on a study in which I have to match the respondents based on their best friend's age and sex. An example looks like the following. I would like to use the respondent's age and sex and his/her best friend's age and sex to predict the number of hours a respondent goes to a party a week. However, to examine whether the effect is really from the best friend or from the sex and age of the best friend, I want to do random matching based on the best friend's age and sex. That is, I would like assign each respondents to a person who has the same age and sex as his/her best friend but is in fact not his/her best friend. For example, for the first respondent, he should be match with the best friend of the fourth respondent, and the second respondent should be match with the 8th, etc.
ID friend's sex friend's age sex age party hour/week
1 F 20 M 30 5h
2 M 21 F 29 0h
3 F 23 F 25 3h
4 F 20 M 24 1h
5 M 22 M 22 3h
6 F 20 F 21 5h
7 F 23 F 22 4h
8 M 21 F 20 5h
9 F 24 M 20 10h
10 F 24 F 27 8h
Which of the following are true
1 - The friends are not part of the respondents
2- No two respondents have the same best friend
3- You want exact matches on sex and age
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.