Vinh, you are picking up quickly but you need to read the documentation (and posts on the list) more carefully. Stata is case-sensitive, so r(rho) is not the same as r(Rho). The former is a scalar; you want the latter.
If you have three variables, you obviously want three coefficients so you need to extract three cells from r(Rho), i.e., three calls to el(), not just one. You also want to create three new variables, not just one, like you do now. I leave it to you to figure out the rest of the code as I believe this will help you more than me posting the solution. You have the basics down already.
Just one more word of advice. Do not even try to call rangerun until you get what you want from your program. Likewise, do not even write the program until you figure out how to get what you want interactively after a simple call to spearman.
Best
Daniel
If you have three variables, you obviously want three coefficients so you need to extract three cells from r(Rho), i.e., three calls to el(), not just one. You also want to create three new variables, not just one, like you do now. I leave it to you to figure out the rest of the code as I believe this will help you more than me posting the solution. You have the basics down already.
Just one more word of advice. Do not even try to call rangerun until you get what you want from your program. Likewise, do not even write the program until you figure out how to get what you want interactively after a simple call to spearman.
Best
Daniel
Comment