Data linking involves combining data from different sources to create a comprehensive dataset. Hash functions can generate unique identifiers for records in different datasets, allowing researchers to link data without exposing sensitive information. This is particularly useful in longitudinal studies where data is collected over time.