From the course: Advanced and Specialized Statistics with Stata

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Graphing by groups

Graphing by groups - Stata Tutorial

From the course: Advanced and Specialized Statistics with Stata

Start my 1-month free trial

Graphing by groups

Let's examine how we can graph by groups. Stata can quickly graph over multiple groups using the by option. While similar effects can be achieved with the if condition this usually takes a lot more code. The by option avoids this problem and makes visual data exploration faster and more efficient. Here's an example of a graph that was made using the by option. This graph consists of many smaller sub-graphs that repeat the command over the sub-groups specified with by. It's a great way to do a lot of graphical analysis quickly. The graph also uses several visual options that we'll explore in this session. The Stata option that we're going to use in this session is the by option which can be used with any Stata graph. The by option will repeat the requested Stata graph for each value of the viable list specified in the by option, and yes you can specify multiple variables. The by option also has a series of sub-options…

Contents