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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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