Dear Experts
I did just start using Stata and I am facing a problem which I cannot solve right now. I want to calculate the spearman correlation of some variables within an observation with a sequence of hypothetical variables. Let me show you the structure of the data:
ID V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 1 2 3 4 5 6 7 8 9 10
The ID shows the number of the Observation. Now I want to have the spearman correlation between the sequence of Variables (V1 - V10) with the hypothetical values of 1-10. Then I want to create a new variable (V11) which gives the coefficient (in this case = 1). This I want to do with around 150 different observations.
It was easy in Excel with the command =Correl(rank.avg(V1-V10;V1-V10;1);rank.avg(1-10;1-10;1))
It seems that I struggle with the way of how Stata handles the variable / observations.
Any Suggestions?
Thank you all in advance.
Best
Jonas
I did just start using Stata and I am facing a problem which I cannot solve right now. I want to calculate the spearman correlation of some variables within an observation with a sequence of hypothetical variables. Let me show you the structure of the data:
ID V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1 1 2 3 4 5 6 7 8 9 10
The ID shows the number of the Observation. Now I want to have the spearman correlation between the sequence of Variables (V1 - V10) with the hypothetical values of 1-10. Then I want to create a new variable (V11) which gives the coefficient (in this case = 1). This I want to do with around 150 different observations.
It was easy in Excel with the command =Correl(rank.avg(V1-V10;V1-V10;1);rank.avg(1-10;1-10;1))
It seems that I struggle with the way of how Stata handles the variable / observations.
Any Suggestions?
Thank you all in advance.
Best
Jonas
Comment