Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Drop Observations if Greater than A Particular Date


From   Lisa Wang <[email protected]>
To   [email protected]
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,
Lisa
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index