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
Sorting issue when sort is expanded by a variableHello, I have an issue running the following command Code: sort id _mi_m survey expectation gift…
Replace a value of multiple observations for one variableDear all, I have a variable name "village", and wanted to replace the name of village in observation…
Estimating slope at different points of intervalGood morning, I allow myself to ask for help once again with some methodology. I am doing research t…
How to know the impacts of other variables on the DID estimate?I have searched around but didn't have any luck. I am trying to estimate and then compare the DID es…
lowess with confidence intervalsDear Stata users, I am wondering is it possible to graph the lowess smoothing function with confide…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping duplicate observations conditioned on another variable
Post a Comment