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]
Re: st: Catplot for three variables on same graph
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Catplot for three variables on same graph
Date
Sat, 28 Dec 2013 18:26:12 +0000
<>
Your question here appears to centre on how to get your data in shape
for a graph, not the details of using -catplot- (a user-written
command from SSC, as you are asked to explain).
But t's not obvious that you need to -reshape- at all.
catplot education region urban
is but one of several legal commands, with modifications for your
exact variable names.
Nick
[email protected]
On 28 December 2013 17:17, Almazea Fatima <[email protected]> wrote:
> 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
>> [email protected]
>>
> 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?
*
* 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/