I had a dataset which didn't contain month or year columns (I imported monthly spss file with no date column) and created a date column like this:
*created year and month values when I imported (in a loop) like this
gen year= 2020
gen month=`i'
*Created a monthdate column
gen monthdate = ym(year, month)
format monthdate %tm
I then wanted to drop the month of January but I keep getting an error (r(198)). Does this have to do with my data type?
*drop jan 2020
drop if monthdate == 2020m1
I also tried putting 2020m1 in quotations ("2020m1") but I got error r(109).
What am I missing?
Related Posts with How to drop date row from dataset
MESR (multinational endogenous switching regression)Dear Statalist users Would you voluntarily give the Stata command for MESRM and how to calculate th…
Coefplot for coefficient of various estimatesThe following code is supposed to create a graph ( like the attached one here ) but unfortunately, I…
Estimation of ATT and ATU for Endogenous Switching Regression ModelDear Statalist Users I am using an endogenous switching regression (ESR) model to conduct my resear…
sigma_u=0 in random effects modelHi all, this is my first post so please let me know if anything can be improved upon! I am conducti…
Open XML file in StataHello everyone, I am trying to read data from an XML file to Stata. The XML file contains all chang…
Subscribe to:
Post Comments (Atom)
0 Response to How to drop date row from dataset
Post a Comment