Hello,
I am trying to create a graph which I am sure is quite simple but have not been able to find in my search of previous forum posts. I have a categorical variable (vistype) that has three levels (0=In-person, 1=Telemedicine, 2=Telephone) and I want to create a bar chart for how the frequencies change monthly over 13 months (September 2019 to September 2020). I have a variable "mydate" that is a month and year. Using "graph bar (count) vistype, over(mydate) stack" almost gets me what I want except I can't see the frequencies of the different values of vistype. Dataex example below.
In summary, I want a stacked bar with frequencies on the y axis, months on the x axis (Sept 2019, Oct 2019 etc.) where different colors correspond to the values of the categorical variable vistype. Any help with labeling also much appreciated!
Sarah
I am trying to create a graph which I am sure is quite simple but have not been able to find in my search of previous forum posts. I have a categorical variable (vistype) that has three levels (0=In-person, 1=Telemedicine, 2=Telephone) and I want to create a bar chart for how the frequencies change monthly over 13 months (September 2019 to September 2020). I have a variable "mydate" that is a month and year. Using "graph bar (count) vistype, over(mydate) stack" almost gets me what I want except I can't see the frequencies of the different values of vistype. Dataex example below.
In summary, I want a stacked bar with frequencies on the y axis, months on the x axis (Sept 2019, Oct 2019 etc.) where different colors correspond to the values of the categorical variable vistype. Any help with labeling also much appreciated!
Sarah
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(vistype mydate) 0 721 0 717 0 722 0 725 0 728 0 717 0 722 0 717 0 719 0 719 1 725 0 722 0 718 0 721 0 718 0 720 0 727 0 720 0 726 0 717 0 726 0 727 0 720 1 727 1 724 1 719 0 721 0 724 0 727 0 717 1 727 1 728 0 724 1 724 0 719 2 727 0 718 0 721 1 724 0 718 1 724 0 717 0 722 1 726 0 721 0 716 1 725 1 728 0 721 0 717 1 723 1 725 1 728 0 719 0 726 1 723 0 720 0 727 2 723 2 723 0 718 1 724 1 724 0 721 1 723 1 723 0 727 1 725 0 717 0 722 0 725 0 722 0 719 0 725 0 718 0 724 0 717 0 720 1 724 1 723 0 721 0 728 0 717 1 723 1 725 1 727 1 728 0 718 0 726 0 716 1 723 0 721 1 725 1 723 0 718 0 726 2 722 0 719 1 728 1 724 end format %tm mydate label values vistype vistype label def vistype 0 "In-person", modify label def vistype 1 "Telemedicine", modify label def vistype 2 "Phone", modify
Comment