Hi. Need help with coding.
I have a dataset with two variables (Name and Response).
I want to add two more variables, Obs_No and Freq.
Obs_No is observation number. If name is duplicated, Obs_No should be the same (e.g. Josh and Anna). Freq is number of times the name appears. (see table).
Name Response Obs_No Freq
Ben 1 1 1
Marie 0 2 1
Josh 1 3 2
Josh 0 3 2
Ana 0 4 3
Ana 0 4 3
Ana 1 4 3
Thanks for the help!
yoyong