Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: coding a categorical variable to a % continuous variable


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Re: coding a categorical variable to a % continuous variable
Date   Sun, 13 Jun 2004 11:45:37 -0700 (PDT)

Suzy,

I assume you have data like this:

     age    smoker
      20         0
      21         0
      23         0
      22         1
      24         1
      20         0
      21         1
      22         0
      23         1
      24         1

You can get your graph by collapsing the data over age.

. collapse smoker, by(age)
. replace smoker = 100*smoker
. scatter smoker age

Friedrich Huebler

--- Suzy <[email protected]> wrote:
> Hello,
> 
> I have a dichotomous variable (0=no ; 1=yes) that I would like to
> use in 
> a scatter plot on the y axis as a continuous variable  as a  %
> variable.
> 
> For example:  the x axis could be age and the y axis could be %
> smokers.
> 
> Can anyone help with this ?
> 
> Thank you.
> Suzy


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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