Hi,
I am using Stata 16.1, and have the following (general) issue. I want to drop duplicate observations of one variable (educ) from my dataset but conditioned on another variable (year).
I've found an online dataset, such that it may be easier to talk about. First up I apologize that I am new Stata.
My problem: I want to drop all duplicates of educ for each corresponding year (72 & 74). This means I do not want educ's value to enter for year 72 if it's value has already been observed.
Here is what I've tried do to:
use http://fmwww.bc.edu/ec-p/data/wooldridge/fertil1
keep if year == 72 | year == 74
drop if educ == educ[_n-1] & (year == 72 | year == 74)
The problem:
I am not dropping all duplicates of educ
Any suggestions would be appreciated
Related Posts with Dropping duplicate observations conditioned on another variable
Collapsing a dataset with categorical variablesHi all, I have a dataset with indiviudal-level data that I would like to collapse into household-le…
Local Average Treatment Effect after BiprobitHi all, I would like to know how to compute LATE after a biprobit model with endogenous binary regr…
How to group time datahello I need your help if I want to organize my data and group it by week. for example, I want to ca…
Post-test estimations with imputed data using stcrregDear all, I am using Fine & Gray proportional subhazard models to calculate the effect of some …
Clustered standard errors.This is a conceptual question; I'm struggling to decide whether I should cluster my standard errors.…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping duplicate observations conditioned on another variable
Post a Comment