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
How to save subsets of a variable ? Code: * Example generated by -dataex-. To install: ssc install dataex clear input str6 id byte(inde…
Survival Analysis using Nigeria Demographic and Health Survey dataPlease everyone I have this challenge with setting up my data for survival analysis to study under-5…
Difference-in-Differences with Multiple Treatment Strengths/DosagesHi. I am trying to run a DiD regression to analyze the effect of education policy implementation on …
How to analyze interaction effects after fixed effects count data regression with panel?Hi Statalisters, My current project is using count data model to analyze panel data with fixed effe…
Looping egen mean weightHi all, I am supposed to get a single mean_weight variable. Original egen code: egen weight_mean =…
Subscribe to:
Post Comments (Atom)
0 Response to R (109) error code
Post a Comment