

{"id":12117,"date":"2018-03-29T06:22:38","date_gmt":"2018-03-29T00:52:38","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=12117"},"modified":"2021-05-09T13:16:33","modified_gmt":"2021-05-09T07:46:33","slug":"sas-boxplot","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/","title":{"rendered":"SAS Boxplot &#8211; Explore the Major Types of Boxplots in SAS"},"content":{"rendered":"<p>In the last tutorials, we learned<em><strong> how to create SAS histograms<\/strong><\/em>,\u00a0<strong>pie charts<\/strong>, <strong>bar charts<\/strong> and <strong>scatter plots <\/strong>for analysis and representation of data. Now, we will look at another interesting way in which we can present data, that is SAS boxplots.<\/p>\n<p>We will look at how to create a Boxplot in SAS and the different types of box plots in SAS Programming Language. Lastly, we will discuss some SAS Boxplot examples and SAS Sgplot &amp; SAS gplot\u00a0boxplot in detail.<\/p>\n<p>So, let&#8217;s\u00a0start the tutorial.<\/p>\n<h2>What is a SAS Boxplot?<\/h2>\n<p>A BOXPLOT in SAS creates side-by-side box-and-whiskers plots of measurements organized in groups. A box-and-whiskers plot displays the<em> mean, quartiles, and minimum <\/em>and<em> maximum observations<\/em> for a group. Below image shows how a SAS boxplot looks like:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/box-plot-example.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12131 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/box-plot-example.png\" alt=\"SAS Box Plot Example\" width=\"500\" height=\"300\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/box-plot-example.png 500w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/box-plot-example-150x90.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/box-plot-example-300x180.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<h4>PROC SGPANEL and SGPLOT Procedures<\/h4>\n<p>We saw how sgplot is used to <strong>create bar charts in SAS<\/strong>, the same can be used to create box plots too. In addition to this, we also have the PROC SGPANEL to create box plots in SAS.<\/p>\n<p><strong>Syntax-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">PROC SGPLOT\u00a0 DATA=DATASET;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VBOX VARIABLE \/ category = VARIABLE;\r\nRUN;\r\nPROC SGPANEL\u00a0 DATA=DATASET;;\r\nPANELBY VARIABLE;\r\n\u00a0 VBOX VARIABLE&gt; \/ category = VARIABLE;\r\nRUN;<\/pre>\n<p>The PROC SGPANEL statement identifies the data set that contains the plot variables.<\/p>\n<h4>Simple Boxplot in SAS<\/h4>\n<p>In this type of SAS boxplot, we choose a variable from a dataset that represents a category and other variables whose values get categorized in as many numbers of groups as the number of distinct values in the second variable.<\/p>\n<p>SAS boxplot without any category:<\/p>\n<p><strong>\u00a0Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc sgplot data=mylib.employee;\r\n\u00a0vbox salary;\r\n\u00a0run;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12132 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4.jpg\" alt=\"Simple BoxPlot in SAS - Without Category\" width=\"911\" height=\"683\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4.jpg 911w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4-150x112.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4-300x225.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/2-4-768x576.jpg 768w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/a><\/p>\n<p>A boxplot with the category:<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc sgplot data=mylib.employee;\r\nvbox salary\/ category=gender;\r\n\u00a0run;<\/pre>\n<p><strong>\u00a0<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12133 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2.jpg\" alt=\"Simple Box Plot in SAS - With Category\" width=\"917\" height=\"685\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2.jpg 917w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2-150x112.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2-300x224.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/1-2-768x574.jpg 768w\" sizes=\"auto, (max-width: 917px) 100vw, 917px\" \/><\/a><\/p>\n<h4>SAS Boxplot in Vertical Panels<\/h4>\n<p>This SAS boxplot is a group using another third variable which divides the graph into multiple panels. We can divide the boxplots\u00a0of a variable into many vertical panels(columns). Each panel holds the\u00a0box plots\u00a0for all the categorical\u00a0variables.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc sgpanel data=mylib.employee;\r\npanelby jobcat \/ rows=1 columns=3 ;\r\nvbox salary \/ category= gender;\r\nrun;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12134 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4.jpg\" alt=\"SAS Box plot in Vertical Panels\" width=\"906\" height=\"676\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4.jpg 906w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4-150x112.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4-300x224.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/3-4-768x573.jpg 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/a><\/p>\n<h4>SAS Boxplot in Horizontal Panels<\/h4>\n<p>This is very similar to vertical panels Boxplot. In this SAS boxplot, a variable is divided into rows. Like vertical, in this also we categorize the data upon a third variable.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\">proc sgpanel data=sashelp.heart;\u00a0 \u00a0\u00a0\r\npanelby sex \/ columns=1;\u00a0\r\nhbox cholesterol \/ category=ageatstart ;\r\ntitle \u2018 Cholestrol by Sex and Age Group\u2019;\r\n\u00a0run;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/horizontal-panel.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12135 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/horizontal-panel.gif\" alt=\"SAS Boxplot in Horizontal Panels\" width=\"600\" height=\"400\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>In this SAS tutorial, we understood what is a boxplot in SAS, how can we create a SAS box plot and what are the ways of presenting a box plot. Stay tuned for more interesting topics and for any queries, post your doubts in the comments section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last tutorials, we learned how to create SAS histograms,\u00a0pie charts, bar charts and scatter plots for analysis and representation of data. Now, we will look at another interesting way in which we&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":41804,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[19868,12243,19869],"class_list":["post-12117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sas","tag-sas-boxplot-types","tag-sas-sgplot-procedures","tag-sas-simple-boxplot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SAS Boxplot - Explore the Major Types of Boxplots in SAS - DataFlair<\/title>\n<meta name=\"description\" content=\"SAS Boxplot tutorial comprises types of SAS Box plots, Simple Box Plot in SAS, SAS Boxplot in Horizontal Panels &amp; Verticle panel, PROC SGPANEL, SGPLOT.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/sas-boxplot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAS Boxplot - Explore the Major Types of Boxplots in SAS - DataFlair\" \/>\n<meta property=\"og:description\" content=\"SAS Boxplot tutorial comprises types of SAS Box plots, Simple Box Plot in SAS, SAS Boxplot in Horizontal Panels &amp; Verticle panel, PROC SGPANEL, SGPLOT.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/sas-boxplot\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-29T00:52:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-09T07:46:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SAS Boxplot - Explore the Major Types of Boxplots in SAS - DataFlair","description":"SAS Boxplot tutorial comprises types of SAS Box plots, Simple Box Plot in SAS, SAS Boxplot in Horizontal Panels & Verticle panel, PROC SGPANEL, SGPLOT.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/","og_locale":"en_US","og_type":"article","og_title":"SAS Boxplot - Explore the Major Types of Boxplots in SAS - DataFlair","og_description":"SAS Boxplot tutorial comprises types of SAS Box plots, Simple Box Plot in SAS, SAS Boxplot in Horizontal Panels & Verticle panel, PROC SGPANEL, SGPLOT.","og_url":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-03-29T00:52:38+00:00","article_modified_time":"2021-05-09T07:46:33+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"SAS Boxplot &#8211; Explore the Major Types of Boxplots in SAS","datePublished":"2018-03-29T00:52:38+00:00","dateModified":"2021-05-09T07:46:33+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/"},"wordCount":389,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg","keywords":["SAS Boxplot Types","SAS SGPLOT Procedures","SAS Simple Boxplot"],"articleSection":["SAS Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/sas-boxplot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/","url":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/","name":"SAS Boxplot - Explore the Major Types of Boxplots in SAS - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg","datePublished":"2018-03-29T00:52:38+00:00","dateModified":"2021-05-09T07:46:33+00:00","description":"SAS Boxplot tutorial comprises types of SAS Box plots, Simple Box Plot in SAS, SAS Boxplot in Horizontal Panels & Verticle panel, PROC SGPANEL, SGPLOT.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/sas-boxplot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/Box-plot-01-1.jpg","width":1200,"height":628,"caption":"SAS Boxplot"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/sas-boxplot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"SAS Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/sas\/"},{"@type":"ListItem","position":3,"name":"SAS Boxplot &#8211; Explore the Major Types of Boxplots in SAS"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=12117"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12117\/revisions"}],"predecessor-version":[{"id":93356,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12117\/revisions\/93356"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/41804"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=12117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=12117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=12117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}