Hi. I'm using Stata 12.1 in a Mac. I have value labels already defined in the following way:
10100 [10100] Processing and preserving of meat and production of meat products
10110 [10110] Processing and preserving of meat
.
10810 [10810] Manufacture of sugar
10820 [10820] Manufacture of cocoa; chocolate and sugar confectionery
10830 [10830] Processing of tea and coffee
.
.
11990 [11990] Manufacture of other beverages n.e.c.
As you can see values in this label are of 5 digits. I need to create a new value label based on these labels but for 3 digit codes.
The default case is 101 : I need to reassign the labels ending in two zeros to the corresponding 3 digit code and drop the non used (i.e 10110).
The other case is that of 119 ,in which it has only one possible label but its original value doesn't end in two zeros.
The last case would be that corresponding to 108, I have three different categories and I would like to label it as Unnamed so I can choose later how to define them.
So my new label would look like this:
101 [10100] Processing and preserving of meat and production of meat products
108 Unnamed
119 [11990] Manufacture of other beverages n.e.c.
Is there a way to automatize this in a loop?
Thank you,
Natalie
10100 [10100] Processing and preserving of meat and production of meat products
10110 [10110] Processing and preserving of meat
.
10810 [10810] Manufacture of sugar
10820 [10820] Manufacture of cocoa; chocolate and sugar confectionery
10830 [10830] Processing of tea and coffee
.
.
11990 [11990] Manufacture of other beverages n.e.c.
As you can see values in this label are of 5 digits. I need to create a new value label based on these labels but for 3 digit codes.
The default case is 101 : I need to reassign the labels ending in two zeros to the corresponding 3 digit code and drop the non used (i.e 10110).
The other case is that of 119 ,in which it has only one possible label but its original value doesn't end in two zeros.
The last case would be that corresponding to 108, I have three different categories and I would like to label it as Unnamed so I can choose later how to define them.
So my new label would look like this:
101 [10100] Processing and preserving of meat and production of meat products
108 Unnamed
119 [11990] Manufacture of other beverages n.e.c.
Is there a way to automatize this in a loop?
Thank you,
Natalie
Comment