I am very bad at writing loops in Stata. Here is my question:
I have a dataset with class_id, individual_id, year and test_score. I would like to calculate for each individual observation, the correlation between the individual score and all the scores of the same class (so peers) for the same year. How can I achieve it using the loop? I suppose I can use the command icc?
Thank you for your help.
Best,
I have a dataset with class_id, individual_id, year and test_score. I would like to calculate for each individual observation, the correlation between the individual score and all the scores of the same class (so peers) for the same year. How can I achieve it using the loop? I suppose I can use the command icc?
Thank you for your help.
Best,
Comment