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
Loop for creating different frames based on different idsHi, I have a very big data set (50 million) hourly observations. This data set has ids, dates, pric…
Coefficient, SE and Residuals are same but not the predicted yhatHi, I have noticed that when I run the following, they produce exactly similar results for coeffici…
Looking for example of DO files for calculation of CPIHi everyone! I was wondering if anybody has a do-file and database for calculation of CPI from the s…
Reshape LongI want to format my data from this pattern: Company Name Jul-03 Aug-03 Sep-03 Oct-03 Nov-03 Dec-0…
Making esttab use factor labelsDear All, I am running a regression with country variable, if I run a normal regression in Stata th…
Subscribe to:
Post Comments (Atom)
0 Response to Stata keep first same data by molecule
Post a Comment