Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Drop Observations if Greater than A Particular Date

From   Lisa Wang <>
Subject   st: Drop Observations if Greater than A Particular Date
Date   Wed, 1 Aug 2012 07:59:55 +1000

Hi all,

I have a simple problem but don't understand why it is currently not
working, so any help would be appreciated. I have imported data
(including dates) into Stata from a csv file and then ran code to
change it into %td format

-generate edate = date(date, "YMD") 		//translate string dates into lapsed dates
format edate %td
drop date
rename edate date
label variable date Date-

I then would like to drop observations where the date is greater than
20-07-2006. I did -drop if date>20072006- but that does not drop any
observations at all when I can see that there are instances where the
date is greater than this.

Do I have to convert my 20-07-2006 back into lapsed dates, then how do
I work out what value this corresponds to? I would have thought it
would be easier than this.

Thank you for your suggestions,
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index