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
Converting Date-Month-Year (string) to yearDear Stata Members I have an issue which I know is the most answered questions in this form, I tried…
Create variable using expansion factorDear all, I would like to ask you a question. In a database I have identified a group of people, who…
error: depvar may not be a factor variableHey everybody, I want to run a regression with binary variables but I am getting this error: depvar…
Generate two new variables in Stata representing the change in net-pay and the change in well-being between june and octoberHi, I'm new to Stata how can I show the above statement in Stata? I would really appreciate any advi…
Generalized propensity score matching for multilevel treatmentHi, I am a first-time user of the generalized propensity score. I have 3 treatment levels that are …
Subscribe to:
Post Comments (Atom)
0 Response to How to drop date row from dataset
Post a Comment