BookmarkSubscribeRSS Feed
yuchinher
Calcite | Level 5

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

 
I would be really appreciated if anyone can help me regarding how to program this and to make a random matching using age and sex possible. Any advice or question are also welcome.
 
Best,
 
 
 
 
2 REPLIES 2
Reeza
Super User
PROC PSMATCH or search greedy match macro Mayo Clinic.
PGStats
Opal | Level 21

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

PG

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1576 views
  • 0 likes
  • 3 in conversation