Hello all,
apologies if this is a silly Q but I am a very newbie in Stata and just learning it!
I wish to use the following commands :
gen month=month(date)
gen year=year(date
gen order_month=01 if month==03 & year==2016
replace order_month=02 if month==04 & year==2016
replace order_month=03 if month==05 & year==2016
I've used the: gen month=month(date) & gen year=year(date) to generate the month and year but when I am trying to use the rest ones I get an error R(109) saying :
" In an expression, you attempted to combine a string and numeric
subexpression in a logically impossible way. For instance, you
attempted to subtract a string from a number or you attempted
to take the substring of a number."
the month variable is a str2 type and the year str4 type if that helps.
I don't know what I am doing wrong and how to resolve it.
Apologies again if this is a silly Q. If anyone wishes to spend some time and help me I really appreciate it.
thank you,
Maria
Related Posts with R (109) error code
Changing directories based on a condition.Hello. I am having issues generating a correct command for the following condition. I have a do file…
Graphical display of multiple OLS regressionsHi All, I am running regression models with the same outcome and independent variables across 5 cou…
Convex hulls on scatter plotsA search for discussions of convex hulls in Stata forums or outlets reveals various programs from 19…
Predict with oprobit: cross-section by fyearHi all, I need to estimate equation (below) via ordered probit and cross-sectionally by fyear. And …
Calculating difference between two times in minutesI have two variables - bed time and wake time. bed time is formulated like: 21_30 and wake time is f…
Subscribe to:
Post Comments (Atom)
0 Response to R (109) error code
Post a Comment