

{"id":12050,"date":"2018-03-28T10:28:07","date_gmt":"2018-03-28T04:58:07","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=12050"},"modified":"2021-05-09T13:16:35","modified_gmt":"2021-05-09T07:46:35","slug":"sas-bar-chart","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/","title":{"rendered":"SAS Bar Chart &#8211; Explore the Different Types of Bar Charts in SAS"},"content":{"rendered":"<p>Previously, we learned about <strong>SAS Histogram<\/strong>, now we will look at the SAS bar chart.<\/p>\n<p>We will learn how to create a bar chart in SAS Programming Language and the different types of SAS bar charts: SAS simple bar chart, SAS stacked bar chart (SAS grouped\u00a0bar chart), and\u00a0SAS cluster bar chart (SAS bar chart side by side).<\/p>\n<p>So, let&#8217;s start the tutorial.<\/p>\n<h2>What is Bar Chart in SAS?<\/h2>\n<p>SAS bar chart shows the distribution of a categorical variable. The bar chart in SAS is some of\u00a0the most commonly used graphs to convey information to the reader.\u00a0Bar charts are used across all domains, including business, finance, banking, clinical and health, and life sciences.<\/p>\n<p>Below is what a typical SAS bar chart looks like:<\/p>\n<p><strong>Example 1-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12061 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2.png\" alt=\"SAS Bar Chart\u00a0Example 1\" width=\"1000\" height=\"600\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2.png 1000w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2-150x90.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2-300x180.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/bar-chart-example-2-768x461.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p><strong>Example 2-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/example-of-bar-chart.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12062 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/example-of-bar-chart.png\" alt=\"SAS Bar Chart\u00a0Example 2\" width=\"640\" height=\"480\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/example-of-bar-chart.png 640w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/example-of-bar-chart-150x113.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/example-of-bar-chart-300x225.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<h4>The PROC SGPLOT Procedure<\/h4>\n<p>The basic syntax to create a SAS bar chart is:<\/p>\n<pre class=\"EnlighterJSRAW\">PROC SGPLOT DATA = DATASET;\r\nVBAR variables;\r\nRUN;<\/pre>\n<p>PROC SGPLOT is used to create a\u00a0bar chart in SAS.<br \/>\nA\u00a0VBAR statement is used to create a vertical SAS bar chart of the variable.<\/p>\n<h4>SAS Simple Bar Chart<\/h4>\n<p>A simple bar chart in SAS is the one that has single vertical bars. We have used the Olympics data set. This SAS Bar chart shows the number of countries in each region that participated in the 2012 Olympics.<\/p>\n<pre class=\"EnlighterJSRAW\">PROC SGPLOT DATA = olympics;\r\n\u00a0VBAR Region;\r\nTITLE 'Olympic Countries by Region';\r\nRUN;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12063 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart.jpg\" alt=\"SAS Bar Chart\" width=\"1080\" height=\"846\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart.jpg 1080w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart-150x118.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart-300x235.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart-768x602.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/simple-bar-chart-1024x802.jpg 1024w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/p>\n<h4>SAS Stacked Bar Chart<\/h4>\n<p>In this type of SAS bar chart, a variable\u2019s value is represented with respect to another variable. Here, the bars have been divided into groups using the GROUP= option. The grouping variable is a categorical variable named PopGroup. By default, SAS creates stacked bars.<\/p>\n<pre class=\"EnlighterJSRAW\">PROC SGPLOT DATA = olympics;\r\nVBAR Region \/ GROUP = PopGroup;\r\nTITLE 'Olympic Countries by Region and Population Group';\r\nRUN;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12064 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart.jpg\" alt=\"SAS Bar Chart\" width=\"1080\" height=\"829\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart.jpg 1080w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart-150x115.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart-300x230.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart-768x590.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/stacked-bar-chart-1024x786.jpg 1024w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/p>\n<h4>SAS Clustered Bar Chart<\/h4>\n<p>Like in the previous example the groups were stacked one above the other, the variables can be stacked next to each other that is side by side. You can specify side-by-side groups instead of stacked groups by adding the option GROUPDISPLAY = CLUSTER to the VBAR statement.<\/p>\n<pre class=\"EnlighterJSRAW\">PROC SGPLOT DATA = olympics;\r\n\u00a0VBAR Region \/ GROUP = PopGroup GROUPDISPLAY = CLUSTER;\r\nTITLE 'Olympic Countries by Region and Population Group';\r\nRUN;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-12065 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart.jpg\" alt=\"SAS Clustered Bar Chart\" width=\"1080\" height=\"804\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart.jpg 1080w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart-150x112.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart-300x223.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart-768x572.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/clustered-bar-chart-1024x762.jpg 1024w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><\/p>\n<p>This comes to the end of the tutorial.<\/p>\n<h2>Summary<\/h2>\n<p>We hope you understood the different types of SAS bar charts.\u00a0If you have any queries, feel free to ask in the comment section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously, we learned about SAS Histogram, now we will look at the SAS bar chart. We will learn how to create a bar chart in SAS Programming Language and the different types of SAS&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":12060,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[11914,11958,12245,12263],"class_list":["post-12050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sas","tag-sas-bar-chart","tag-sas-clustered-bar-chart","tag-sas-simple-bar-chart","tag-sas-stacked-bar-chart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SAS Bar Chart - Explore the Different Types of Bar Charts in SAS - DataFlair<\/title>\n<meta name=\"description\" content=\"With the SAS bar chart tutorial, learn the types of SAS bar charts with examples; SAS simple chart, SAS stacked chart, SAS clustered chart. Explore now!\" \/>\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-bar-chart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAS Bar Chart - Explore the Different Types of Bar Charts in SAS - DataFlair\" \/>\n<meta property=\"og:description\" content=\"With the SAS bar chart tutorial, learn the types of SAS bar charts with examples; SAS simple chart, SAS stacked chart, SAS clustered chart. Explore now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/\" \/>\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-28T04:58:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-09T07:46:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.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 Bar Chart - Explore the Different Types of Bar Charts in SAS - DataFlair","description":"With the SAS bar chart tutorial, learn the types of SAS bar charts with examples; SAS simple chart, SAS stacked chart, SAS clustered chart. Explore now!","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-bar-chart\/","og_locale":"en_US","og_type":"article","og_title":"SAS Bar Chart - Explore the Different Types of Bar Charts in SAS - DataFlair","og_description":"With the SAS bar chart tutorial, learn the types of SAS bar charts with examples; SAS simple chart, SAS stacked chart, SAS clustered chart. Explore now!","og_url":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-03-28T04:58:07+00:00","article_modified_time":"2021-05-09T07:46:35+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.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-bar-chart\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"SAS Bar Chart &#8211; Explore the Different Types of Bar Charts in SAS","datePublished":"2018-03-28T04:58:07+00:00","dateModified":"2021-05-09T07:46:35+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/"},"wordCount":361,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.jpg","keywords":["SAS Bar Chart","SAS Clustered Bar Chart","SAS Simple Bar Chart","SAS Stacked Bar Chart"],"articleSection":["SAS Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/","url":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/","name":"SAS Bar Chart - Explore the Different Types of Bar Charts in SAS - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.jpg","datePublished":"2018-03-28T04:58:07+00:00","dateModified":"2021-05-09T07:46:35+00:00","description":"With the SAS bar chart tutorial, learn the types of SAS bar charts with examples; SAS simple chart, SAS stacked chart, SAS clustered chart. Explore now!","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/sas-bar-chart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/03\/SAS-BAR-Chart-01.jpg","width":1200,"height":628,"caption":"SAS Bar Chart"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/sas-bar-chart\/#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 Bar Chart &#8211; Explore the Different Types of Bar Charts 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\/12050","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=12050"}],"version-history":[{"count":10,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12050\/revisions"}],"predecessor-version":[{"id":93360,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/12050\/revisions\/93360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/12060"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=12050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=12050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=12050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}