Although Momo's precise problem is not at all clear to me it was stated here that == doesn't work in the sense that "type mismatch" is the error message.

The issue is presumably that one variable is string and the other numeric. Perhaps applying -destring- to the string variable with numeric content is the easiest thing to do first.

Nick

[hidden email]
Cardani Roberta

drop var11 if (var11==var5)

you need = =

momo

I have a dataset with the following shape:

var1.......var5......var10(which sum obs in var11)... var11

co. N......1203.........................3........ ........................

.................................................. .....................1450

..................................................

......................1203

..................................................

......................1620

co.N......etc

so, I need to drop the observations in var11 which equal the unique value in

var5. in the example above I want to drop the observations in var11=1203

that =1203 in var5 for each var1(company).

I tries

drop var11 if (var11=var5) but doesn't work and gives me, var11=var5 invalid

name

or type mismatch if I put ==

in addition how can I change the value of var10 to be 2 in the example above

instead of 3 after dropping the observation that =1203 in var11. I.e to

change the summation of var11, which var10=number of observations in var11.

*

* For searches and help try:

*

http://www.stata.com/help.cgi?search*

http://www.stata.com/support/statalist/faq*

http://www.ats.ucla.edu/stat/stata/