[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Graphing a string variable

From   "Alan Neustadtl" <>
Subject   Re: st: Graphing a string variable
Date   Fri, 5 Oct 2007 11:21:52 -0400

The encode command may be what you are looking for.

help encode provides the following:

encode varname [if] [in] , generate(newvar) [label(name) noextend]

"encode creates a new variable named newvar based on the string variable
    varname, creating, adding to, or just using (as necessary) the value label
    newvar or, if specified, name.  Do not use encode if varname contains
    numbers that merely happen to be stored as strings; instead, use generate
    newvar = real(varname) or destring; see real() or [D] destring."


On 10/5/07, Colleen Murphy <> wrote:
> Hi
> I have a dataset with censored observations. Many values of the
> observations are recorded as for example "<2", ">16", including
> "greater than or equal to" a value and "less than or equal to" a
> value. The variables with these observations are string-type variables
> in STATA.  I would like to create a simple bar graph that shows the
> frequency of observations and have it sorted by numeric value. As in
> on the x-axis would have the values <2, 2, 4, >4. (in that order) and
> the y-axis would be the frequency of those values.
> Any assistance with this would be greatly appreciated.
> Thanks
> Colleen Murphy
> --
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index