[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: recoding strings variables to numerical
I don't know why you tried -destring-. This is for
variables that should be numeric, but just missed being
read as such. Variables that are all words are the other
end of the spectrum from that.
In your case, the answer sounds like -encode-, but create
the labels first. A sensible order given "low" "medium"
"high" "vhigh" is just that, but -encode- by default just
looks at alphabetical order.
A more general discussion of the whole string-numeric issue
was included in Stata Journal 2(3) 2002.
> stata 8.2. winxp.
> trying to recode string variables (counts) consisting of
> 'high', 'low',
> 'medium', 'vhigh', etc to numerical values e.g. high = 1,
> low=2. look up
> manuals - recode for numerical only, destring
> replace/generate did not work.
> any suggestions or work around? i started with something like
> gen counts2=.
> but then i am stuck as to what to do next. would appreciate help.
* For searches and help try: