Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Catplot for three variables on same graph


From   Almazea Fatima <almazea.fatima@sydney.edu.au>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Catplot for three variables on same graph
Date   Sat, 28 Dec 2013 17:17:33 +0000

Hi Statalist,

I have three category variables with following value labels

Education:   1 ==yes 2== No
Region: Punjab==0 Sindh==1 KPK==2 Balochistan==3
urban: urban==0 rural==1


I followed following suggestions by Nick

Here's the flavour of a -reshape- solution
> 
> sysuse auto , clear
> local lab1 "`: var label foreign'"
> local lab2 "`: var label rep78'"
> rename (foreign rep78) (catforeign catrep78)
> reshape long cat , i(make) string
> replace _j = "`lab1'" if _j == "foreign"
> replace _j = "`lab2'" if _j == "rep78"
> catplot cat _j , percent(_j) nofill recast(bar)
> 
> 
> Nick
> n.j.cox@durham.ac.uk
> 
I am facing a problem in plotting graph because when I reshape, value labels for education and region disappear and there is only rural urban in "cat" variable along with some numbers. I guess I have to rework value labels and put some unique values, Even I tried this but still not working.

Have any body idea, what mistake I am doing and what is solution?

Regards
Almazea
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index