I have to collapse
some variable of my dataset but I’m getting issues.
Basically, there are 2 variables
valor_receita_propria
(in English is own_revenue_value)qt_tec_total
(or total_tec_qt, the numberof technicians in a institution).
There are 2 dummy variables which specify if the value of the above mentioned variables refer to each individual plant or to his enterprise.
For example, if in_refT
equals 1, then the value of qt_tec_total
of that plant actually refers to the whole enterprise. If in_refT
equals 2, then the value of that plant refers to that singular plant.
What I need to do is aggregate all the values for enterprise. My plan was take the mean of all values referring to the enterprise and take the sum of all values referring to each plant, so I wrote:
. collapse (sum) receitasum=vl_receita_propria if in_refC==2 (sum) tecsum=qt_tec_total if in_refT==2 (mean) receitasum=vl_receita_propria if in_refC==1 (mean) tecsum=qt_tec_total if in_refT==1 (sum) em_exerc (sum) doc_do (sum) qt_matricula_curso1, by (ano CO_MANT3)
I need that it results only one variable of each kind referring only and exclusively to each whole enterprise. However, it shows this error:
invalid '(' r(198);