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
Using bayesstats summary on pooled multiple chain data.Dear Statalisters, Is there a way to summarize amalgamated data from multiple chains with bayesstats…
How to recode a trinary variable into a binaryHello. I'm new to Stata, and I have a quick question. I have a variable "size" in my data base : 1 i…
PCA with weights?Dear All, I was wondering if weights should be used with the PCA command when constructing an index …
[Help] Marginal effect on StataHi. My question is from Stata (15.1), but also requires some statistical knowledge, which is why I a…
Two-part modeling: combination of LCA and LPAHi Statalists, I was trying to do a two-part modeling for my dataset, in which observed vars are ze…
Subscribe to:
Post Comments (Atom)
0 Response to Dropping duplicate observations conditioned on another variable
Post a Comment