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
Extracing dates from both long and file name in stringDear Statalists, I am trying to do a subtraction between dates to come up with the time interval be…
Creating panel structure - any precise way?Hello, I am trying to create a panel structure with three dimensions: exporting country, importing c…
CMP - Saving random effects coefficientsIs there any way to obtain estimated coefficients for random effects after estimating a system of eq…
Problem with Panel ARDL lag selectioni am a phd student working on Oil Price Shocks and asymmetries of industrial production for which i …
How to choose between two possible ways to examine a relationship (Combine variables in one regression or split it into two regressions)Hi All, I have an unbalanced panel data (T=9, N=85). I want to run Fixed effect regression to exami…
Subscribe to:
Post Comments (Atom)
0 Response to R (109) error code
Post a Comment