I am trying to understand the goal of Part 1 of homework 5: label the variables and values of "heartatk", "rural" and "race": are we just label define heartatk 0 "No Heart Attack" and label define heartatk 1 "Heart Attack" then doing the same for all the other ones (rural and race)? Or is the goal to do something else? Thank you.
Yes, that is the goal for part 1. You'll notice that if you tabulate heartatk before adding labels that the categories are 0 & 1. To submit a table for publication you need informative labels for the categories.
Here is an example:
webuse nhanes2, clear
tab highbp
label variable highbp "high systolic blood pressure"
label define bplabel 1 ">=140" 0 "<140"
label values highbp bplabel
tab highbp