Dear Listers
I would like to replace a variable by the first occurrence of another variable.
i want second[_n] to be replaced by first by id
so i tryed
that just changed all second values to : second==first
so i tryed
that gave me a weights not allowed error.
Hope you understand what i want and can tell me how to do it.
Lars
I would like to replace a variable by the first occurrence of another variable.
Code:
input id first second 1 50.1 50 1 50.1 51 1 50.1 52 2 60.3 60 2 60.3 61 2 60.3 62 end
so i tryed
Code:
bysort id: replace second=first if second==second[_n]
so i tryed
Code:
bysort id: replace second[_n]==first[_n]
Hope you understand what i want and can tell me how to do it.
Lars
Comment