Hi,

I have a long dataset and I want to tab and analyse outcomes by sex, pmqreg and age. At the minute for each id the sex is repeated for the same id. So when I tabulate I get a false number of males and females instead of couting by id. I cannot reshape wide as I need it in long to do the kind of analysis I want. How can I delete all but the first value for sex per id, and leave the others as missing?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(id sex pmqreg age ayear y outcome)
1 1 2 1 2010  4 1
1 1 2 1 2011  5 1
1 1 2 1 2012  6 0
2 0 1 1 2013  6 1
2 0 1 1 2014  7 1
3 0 3 1 2017  8 1
3 0 3 1 2018  9 1
3 0 3 1    .  . .
3 0 3 1    .  . .
3 0 3 1    .  . .
4 1 1 0 2010  4 1
4 1 1 0 2011  5 1
5 0 1 1 2012  5 1
5 0 1 1 2013  6 1
5 0 1 1 2014  7 0
5 0 1 1    .  . .
6 1 2 0 2014 10 0
end


Thanks,
Carla