I am appending datasets in which the same variable have different label values. In the example below is a simplification of the problem. In the first dataset the variable -prod_id- has values according to the label cerais__id (which ranges from 1 to 22) whereas this variable has values according to the label acucar__id in the second dataset (which ranges from 114 to 115). How can I have a code that attaches, after appending, a value label to variable -prod_id- that contains all values defined in both datasets (e.g. 1-22 as well as 114-115)?
Many thanks!!
Many thanks!!
Code:
. use cerais_2, clear
. des prod_id
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------------------------------------------------------------
prod_id double %6.2f cerais__id
Roster instance identifier
. label list cerais__id
cerais__id:
1 Arroz local de bolanha
2 Arroz local de Npampam
3 Arroz importado perfumado
4 Arroz importado simples
5 Milho bacil em espiga
6 Milho bacil em grão
7 Milho preto
8 Milho cavalo/Sorgo
10 Fundo
12 Farinha de milho bacil
13 Farinha de milho preto
14 Farinha de trigo local ou importado
16 Massas alimentícias
17 Pão moderno
18 Pão tradicional
19 Croissants
20 Bolachas
21 Bolos
22 Donetes/panguetes, panquecas
.
. use acucar_2, clear
. des prod_id
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------------------------------------------------------------
prod_id double %6.2f acucar__id
Roster instance identifier
. label list acucar__id
acucar__id:
114 Açúcar (em pó ou cubos)
115 Mel
.
. use cerais_2, clear
. append using acucar_2
. des prod_id
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------------------------------------------------------------
prod_id double %6.2f cerais__id
Roster instance identifier
.
end of do-file
.

Comment