Hello All,
I am relatively new to this forum. I am trying to do something that simple in excel but is evidently difficult in STATA. I am trying to use output from two subgroups in the same line graph. Graph combine is NOT the command that I wish to use. Let me explain. After searching the forum, I have realized that graph combine merely adds multiple graphs into 1 figure. Hypothetically, with two subgroups, graph combine would produce 1 figure with 2 graph panes. My needs are different. I need ONE graph pane with 2 lines from the two subgroups. Here is the code that I am trying. I also need to keep the "if race==1" type statements.
// prepare example data
sysuse nlsw88, clear
gen lnwage = ln(wage)
// collect means and standard deviations
mean lnwage if race == 1, over(tenure)
local m_w = r(mean)
local sd_w = r(sd)
mean lnwage if race == 2, over (tenure)
local m_b = r(mean)
local sd_b = r(sd)
// plot various
twoway line white = normalden(x,`m_w',`sd_w') , range(0 4) || ///
line black = normalden(x,`m_b',`sd_b') , range(0 4)
I am relatively new to this forum. I am trying to do something that simple in excel but is evidently difficult in STATA. I am trying to use output from two subgroups in the same line graph. Graph combine is NOT the command that I wish to use. Let me explain. After searching the forum, I have realized that graph combine merely adds multiple graphs into 1 figure. Hypothetically, with two subgroups, graph combine would produce 1 figure with 2 graph panes. My needs are different. I need ONE graph pane with 2 lines from the two subgroups. Here is the code that I am trying. I also need to keep the "if race==1" type statements.
// prepare example data
sysuse nlsw88, clear
gen lnwage = ln(wage)
// collect means and standard deviations
mean lnwage if race == 1, over(tenure)
local m_w = r(mean)
local sd_w = r(sd)
mean lnwage if race == 2, over (tenure)
local m_b = r(mean)
local sd_b = r(sd)
// plot various
twoway line white = normalden(x,`m_w',`sd_w') , range(0 4) || ///
line black = normalden(x,`m_b',`sd_b') , range(0 4)
Keep in mind, I am new to STATA graphics.
I haven't really posted on this forum much, so I apologize in advance for any missteps in my post.
Comment