Hey stata community,
I'm very new in using stata and have a question concerning the use of keeping same values.
My dataset looks like this:
Date | Molecule
01.01.1995 | Molecule 1
01.01.1995 | Molecule 1
10.05.1995 | Molecule 1
03.04.1998 | Molecule 2
03.04.1998 | Molecule 2
03.04.1998 | Molecule 2
05.07.1999 | Molecule 2
...
I only want to keep the first same values (date) per molecule, like this:
Date | Molecule
01.01.1995 | Molecule 1
01.01.1995 | Molecule 1
03.04.1998 | Molecule 2
03.04.1998 | Molecule 2
03.04.1998 | Molecule 2
...
How do I get there? The command sortby id: keep if _n==1 did not work as that only took the first of the observations.
Best regards,
Milena
Related Posts with Stata keep first same data by molecule
Computer says 'no' - How to allocate more memory for STATA[Please note: I've looked at a few other forums with similar problems, but the solutions don't seem …
OlogitI have cross-sectional data for a group of people, the dependent variable is an ordinal variable, an…
Refining starting values stuck during multilevel modellingDear all, I am running a multilevel model for my paper (individuals nested in countries). For the b…
CREATE A BINARY VARIABLE IF A VARIABLE <0 ON SEVERAL YEARSDear statalist, I am trying to construct a binary variable. This binary variable should take the val…
Managing overlapping datesDear all, I am working a study on sick leave in relation to an interested outcome. However, I am st…
Subscribe to:
Post Comments (Atom)
0 Response to Stata keep first same data by molecule
Post a Comment