Hi all,
I am new to Stata. I am working on a dataset where I have countries that are classified from 1 to 27 and each number is associated with a label (e.g. country 1 is Austria)
I would like to play with data in order to see if there is any interesting result. For this reason I often run cycles like:
but the problem is that it is displayed the number of the country while I would like to see the associated label in order to avoid wasting time while looking at the results.
I have
1 Austria
2 Country2
3 C3
4 C4
5 C5
I have read all the guides that I found about labels but I have not understand how to display the associated label instead of the numeric value I would like to show "Austria" knowing that X==1
(I got how to set, list, replace label but not how to show them)
If someone knows python I would like to do - more or less - the same that in python is done via dictionaries e.g. countries = {1:'Austria', 2:'C2' etc.}
countries[1] => Austria
I hope I have been clear.
Thanks in advance for your help.
Have a nice time
I am new to Stata. I am working on a dataset where I have countries that are classified from 1 to 27 and each number is associated with a label (e.g. country 1 is Austria)
I would like to play with data in order to see if there is any interesting result. For this reason I often run cycles like:
Code:
foreach X of numlist 1/27 { display `X' mean variableIWant if Country == `X' }
I have
1 Austria
2 Country2
3 C3
4 C4
5 C5
I have read all the guides that I found about labels but I have not understand how to display the associated label instead of the numeric value I would like to show "Austria" knowing that X==1
(I got how to set, list, replace label but not how to show them)
If someone knows python I would like to do - more or less - the same that in python is done via dictionaries e.g. countries = {1:'Austria', 2:'C2' etc.}
countries[1] => Austria
I hope I have been clear.
Thanks in advance for your help.
Have a nice time
Comment