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

RE: st: RE: bar graph of multiple variables


From   "Sherman, Richard" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: bar graph of multiple variables
Date   Tue, 8 Mar 2005 16:25:47 +0100

Thanks Nick, Clive, and Scott for your collective solution to this
problem.

-Richard


Nick Cox wrote:

-----------------------------
Taking the idea from Clive of using -catplot- and from
Scott that a data restructure is needed, another way is along
these lines. First we create an example dataset as did 
Scott 

clear
set obs 30
qui forv i = 1/7 {
 	gen c`i' = 1
 	replace c`i' = 2 if uniform() <.4
 	replace c`i' = 3 if uniform() <.3
}

Then 

gen id = _n 
reshape long c , i(id) 
catplot bar  c _j 

There is no need to get into file manipulations, 
as all can be done in place.
-----------------------------------

Richard Sherman
Department of Political Science, Leiden University
Leiden, Netherlands
http://homepage.mac.com/richard.sherman/

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************



*
*   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