{"id":3959,"date":"2023-07-14T12:37:48","date_gmt":"2023-07-14T12:37:48","guid":{"rendered":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/"},"modified":"2023-07-14T12:37:48","modified_gmt":"2023-07-14T12:37:48","slug":"sas-proc-sql-hebben","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/","title":{"rendered":"Sas: hoe de having-clausule in proc sql te gebruiken"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de <b>HAVING-<\/b> clausule in <strong>PROC SQL<\/strong> in SAS gebruiken om rijen te filteren die aan een bepaalde voorwaarde voldoen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Let op het subtiele verschil tussen <b>WHERE-<\/b> en <strong>HAVING-<\/strong> clausules:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>WHERE<\/strong> filtert rijen voordat er een groepering plaatsvindt.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>HAVING<\/strong> filtert rijen na elke groepering.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">In het volgende voorbeeld ziet u hoe u de <strong>HAVING-<\/strong> clausule in de praktijk kunt gebruiken.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld: hoe u de HAVING-clausule in PROC SQL gebruikt<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Stel dat we de volgende dataset in SAS hebben die informatie bevat over verschillende basketbalspelers:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">\/*create dataset*\/\n<\/span><span style=\"color: #800080;\">data<\/span> my_data;\n    <span style=\"color: #3366ff;\">input<\/span> team $position $points;\n    <span style=\"color: #3366ff;\">datalines<\/span> ;\nA Guard 22\nA Guard 20\nA Guard 30\nA Forward 14\nA Forward 11\nB Guard 12\nB Guard 22\nB Forward 30\nB Forward 9\nB Forward 12\nB Forward 25\nC Guard 22\nC Guard 19\nC Guard 10\n;\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view dataset*\/\n<\/span><span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> =my_data;<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-31773 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/avoir1.jpg\" alt=\"\" width=\"236\" height=\"404\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">We kunnen de volgende code gebruiken om de som van de punten te berekenen die zijn gescoord door spelers in elk team <strong>WAAR<\/strong> de spelers bewakers zijn, en vervolgens de resultaten filteren om alleen teams weer te geven die een som groter dan 50 <strong>hebben<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\">proc sql<\/span> ;\n    <span style=\"color: #3366ff;\">select<\/span> team, sum(points) <span style=\"color: #3366ff;\">as<\/span> sum_points\n    <span style=\"color: #3366ff;\">from<\/span> my_data\n    <span style=\"color: #3366ff;\">where<\/span> position='Guard'\n    <span style=\"color: #3366ff;\">group<\/span> by team\n    <span style=\"color: #3366ff;\">having<\/span> sum_points &gt; <span style=\"color: #008000;\">50<\/span> ;\n<span style=\"color: #800080;\">quit<\/span> ;<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-31774 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/avoir2.jpg\" alt=\"\" width=\"157\" height=\"86\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Hier is precies hoe deze code werkte:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">Eerst hebben we <strong>SELECT<\/strong> gebruikt om het team en de puntensom te selecteren<\/span><\/li>\n<li> <span style=\"color: #000000;\">Vervolgens gebruikten we <strong>WHERE<\/strong> om rijen te filteren waar de positie &#8218;Bewaker&#8216; was<\/span><\/li>\n<li> <span style=\"color: #000000;\">Vervolgens hebben we <strong>GROUP<\/strong> gebruikt om de resultaten per team te groeperen<\/span><\/li>\n<li> <span style=\"color: #000000;\">Vervolgens hebben we <strong>HAVING<\/strong> gebruikt om teams met een puntentotaal &gt; 50 te filteren.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Hier ziet u hoe de resultaten van deze zoekopdracht eruit zouden hebben gezien als we de <strong>HAVING-<\/strong> instructie niet hadden opgenomen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\">proc sql<\/span> ;\n    <span style=\"color: #3366ff;\">select<\/span> team, sum(points) <span style=\"color: #3366ff;\">as<\/span> sum_points\n    <span style=\"color: #3366ff;\">from<\/span> my_data\n    <span style=\"color: #3366ff;\">where<\/span> position='Guard'\n    <span style=\"color: #3366ff;\">group<\/span> by team;\n<span style=\"color: #800080;\">quit<\/span> ;<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-31775 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/avoir3.jpg\" alt=\"\" width=\"166\" height=\"117\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Merk op dat het puntentotaal van team B niet meer dan 50 was.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dus toen we in het vorige voorbeeld de <strong>HAVING-<\/strong> instructie gebruikten, filterden we team B eruit omdat hun puntentotaal niet groter was dan 50.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In de volgende zelfstudies wordt uitgelegd hoe u andere veelvoorkomende taken in SAS kunt uitvoeren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/nl\/sas-proc-sql-achtig\/\" target=\"_blank\" rel=\"noopener\">SAS: hoe u de LIKE-operator gebruikt in PROC SQL<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/sas-proc-sql-in\/\" target=\"_blank\" rel=\"noopener\">SAS: Hoe de IN-operator in PROC SQL te gebruiken<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/sas-proc-sql-of\/\" target=\"_blank\" rel=\"noopener\">SAS: Hoe de WHERE-operator in PROC SQL te gebruiken<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de HAVING- clausule in PROC SQL in SAS gebruiken om rijen te filteren die aan een bepaalde voorwaarde voldoen. Let op het subtiele verschil tussen WHERE- en HAVING- clausules: WHERE filtert rijen voordat er een groepering plaatsvindt. HAVING filtert rijen na elke groepering. In het volgende voorbeeld ziet u hoe u de HAVING- [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-3959","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials<\/title>\n<meta name=\"description\" content=\"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-14T12:37:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/avoir1.jpg\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/\",\"url\":\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/\",\"name\":\"SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-14T12:37:48+00:00\",\"dateModified\":\"2023-07-14T12:37:48+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sas: hoe de having-clausule in proc sql te gebruiken\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials","description":"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.","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:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/","og_locale":"de_DE","og_type":"article","og_title":"SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials","og_description":"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.","og_url":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/","og_site_name":"Statorials","article_published_time":"2023-07-14T12:37:48+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/avoir1.jpg"}],"author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/","url":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/","name":"SAS: Hoe de HAVING-clausule te gebruiken in PROC SQL - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-14T12:37:48+00:00","dateModified":"2023-07-14T12:37:48+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze zelfstudie wordt aan de hand van een voorbeeld uitgelegd hoe u de HAVING-clausule in PROC SQL in SAS gebruikt.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/sas-proc-sql-hebben\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Sas: hoe de having-clausule in proc sql te gebruiken"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/3959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=3959"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/3959\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=3959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=3959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=3959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}