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]

RE: st: Catplot for three variables on same graph


From   Almazea Fatima <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Catplot for three variables on same graph
Date   Tue, 31 Dec 2013 10:50:15 +0000

Thank you Nick.

Regards
Almazea

________________________________________
From: [email protected] [[email protected]] on behalf of Nick Cox [[email protected]]
Sent: Sunday, 29 December 2013 11:52 AM
To: [email protected]
Subject: Re: st: Catplot for three variables on same graph

<>

If I understand you correctly, that's not a -reshape- problem either.
Just -catplot- each variable separately and -graph combine-.

Nick
[email protected]


On 28 December 2013 18:38, Almazea Fatima <[email protected]> wrote:
> Hi Nick
> Thank you for your response.
> Yes, you are right I am facing problem for reshaping data.
> I can't use
> catplot education region urban
> because I don't want stata to use "over" o "by" option, I want to plot all three variables by their own categories while using above command will plot education BY region and urban.
>
> I know the solution is to Reshape, but how should I modify the values of labels for each var so that when they are reshaped in from wide to long they have unique values to be identified?
> Can you help me on this?
>
> Regards
> Almazea
>
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Nick Cox [[email protected]]
> Sent: Sunday, 29 December 2013 5:26 AM
> To: [email protected]
> Subject: Re: st: Catplot for three variables on same graph
>
> <>
>
> 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/
*
*   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