I have a variable whose value is either 'yes', or 'no' ("g1schedule"), which was a sting, and I used 'encode'
encode g1schedule, gen(schedule) The new variable "schedule" is still words, in blue now, not red like strings, which seems to be right, according to here: https://www.stata.com/support/faqs/d...ring-variable/
However this variable wont work as a specification to work on only a subset of studies when using metan, as below:
metan n mean SD n2 mean2 SD2 if schedule ==no, hedges
no not found
r(111);
Variables work here (after 'if) when the value == a number, but not for those where it is a word, even after encoding.
In case it helps:
. describe schedule
storage display value
variable name type format label variable label
---------------------------------------------------------------------------------
schedule long %8.0g schedule g1sleepschedule
Does anyone know if there is something wrong with the variable, or the command syntax?
Many Thanks!
Sophie
encode g1schedule, gen(schedule) The new variable "schedule" is still words, in blue now, not red like strings, which seems to be right, according to here: https://www.stata.com/support/faqs/d...ring-variable/
However this variable wont work as a specification to work on only a subset of studies when using metan, as below:
metan n mean SD n2 mean2 SD2 if schedule ==no, hedges
no not found
r(111);
Variables work here (after 'if) when the value == a number, but not for those where it is a word, even after encoding.
In case it helps:
. describe schedule
storage display value
variable name type format label variable label
---------------------------------------------------------------------------------
schedule long %8.0g schedule g1sleepschedule
Does anyone know if there is something wrong with the variable, or the command syntax?
Many Thanks!
Sophie
Comment