{"id":4579,"date":"2023-07-09T23:07:47","date_gmt":"2023-07-09T23:07:47","guid":{"rendered":"https:\/\/statorials.org\/nl\/sas-countw-functie\/"},"modified":"2023-07-09T23:07:47","modified_gmt":"2023-07-09T23:07:47","slug":"sas-countw-functie","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/sas-countw-functie\/","title":{"rendered":"Hoe de countw-functie in sas te gebruiken (met voorbeeld)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de functie <b>COUNTW<\/b> in SAS gebruiken om het aantal woorden in een tekenreeks te tellen.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Deze functie gebruikt de volgende syntaxis:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>COUNTW(tekenreeks, &lt;karakter&gt;, &lt;modificator&gt;)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Goud:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>string:<\/strong> De string die de woorden bevat die moeten worden geteld<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>karakter<\/strong> : Optionele tekenconstante die een lijst met tekens initialiseert<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>edit<\/strong> : optionele codes die tekens of symbolen specificeren die als scheidingstekens tussen woorden moeten tellen<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Het volgende voorbeeld laat zien hoe u deze functie in de praktijk kunt gebruiken.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Voorbeeld: hoe u de COUNTW-functie in SAS gebruikt<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Laten we aannemen dat we de volgende gegevensset in SAS hebben:<\/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> phrase <span style=\"color: #339966;\">$char50.<\/span> ;\n    <span style=\"color: #3366ff;\">datalines<\/span> ;\nHey_everyone\nWhat's going on today\nWow, what a great day\nLet's have fun\nWe should play basketball\nThis weather is so so awesome\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;\n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-35736 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/seconde-guerre-mondiale.png\" alt=\"\" width=\"278\" height=\"199\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">De volgende code laat zien hoe u de functie <b>COUNTW<\/b> gebruikt om een nieuwe kolom te maken waarin het aantal woorden in elke rij van de <strong>expressiekolom<\/strong> wordt weergegeven:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">\/*create new dataset that shows number of words in each row*\/\n<\/span><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> my_data;\n    word_count = <span style=\"color: #3366ff;\">countw<\/span> (phrase);\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view new dataset*\/\n<\/span><span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> =new_data;<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-35737 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/ww3.png\" alt=\"\" width=\"398\" height=\"217\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Standaard beschouwt de functie <strong>COUNTW<\/strong> alleen spaties als scheidingstekens tussen woorden.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dus:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">In de eerste zin zijn er geen spaties, dus de COUNTW-functie telt in totaal slechts <strong>\u00e9\u00e9n<\/strong> woord.<\/span><\/li>\n<li> <span style=\"color: #000000;\">In de tweede zin zijn er drie spaties, dus de COUNTW-functie heeft in totaal <strong>4<\/strong> woorden.<\/span><\/li>\n<li> <span style=\"color: #000000;\">In de derde zin zijn er vier spaties, dus de COUNTW-functie heeft in totaal <strong>5<\/strong> woorden.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Enzovoort.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We kunnen echter een lijst met modificatoren opgeven die ook als scheidingstekens tussen woorden gelden.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We kunnen bijvoorbeeld de volgende syntaxis gebruiken om te specificeren dat een spatie en een onderstrepingsteken beide als scheidingstekens tussen woorden moeten worden beschouwd:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008000;\">\/*create new dataset that shows number of words in each row*\/\n<\/span><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> my_data;\n    word_count = <span style=\"color: #3366ff;\">countw<\/span> (phrase, '_');\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view new dataset*\/\n<\/span><span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> =new_data;<\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-35738 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/ww4.png\" alt=\"\" width=\"380\" height=\"211\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">De nieuwe kolom <strong>word_count<\/strong> telt nu nauwkeurig het aantal woorden in de eerste zin, omdat we hebben verduidelijkt dat een onderstrepingsteken ook als scheidingsteken tussen woorden moet worden beschouwd.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Let op<\/strong> : U kunt <a href=\"https:\/\/documentation.sas.com\/doc\/en\/pgmsascdc\/9.4_3.5\/lefunctionsref\/p18xi2516ihygyn1qg1b1nby326k.htm\" target=\"_blank\" rel=\"noopener\">hier<\/a> de volledige documentatie voor de SAS <b>COUNTW-<\/b> functie vinden.<\/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> <span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/nl\/sas-extract-kanaalnummer\/\" target=\"_blank\" rel=\"noopener\">Hoe getallen uit een string in SAS te extraheren<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/onder-luchtsluisfunctie\/\" target=\"_blank\" rel=\"noopener\">Hoe de SUBSTR-functie in SAS te gebruiken<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/verwijder-geen-speciale-tekens\/\" target=\"_blank\" rel=\"noopener\">Speciale tekens verwijderen uit tekenreeksen in SAS<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de functie COUNTW in SAS gebruiken om het aantal woorden in een tekenreeks te tellen. Deze functie gebruikt de volgende syntaxis: COUNTW(tekenreeks, &lt;karakter&gt;, &lt;modificator&gt;) Goud: string: De string die de woorden bevat die moeten worden geteld karakter : Optionele tekenconstante die een lijst met tekens initialiseert edit : optionele codes die tekens of [&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-4579","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>Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials<\/title>\n<meta name=\"description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.\" \/>\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-countw-functie\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/sas-countw-functie\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-09T23:07:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/seconde-guerre-mondiale.png\" \/>\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-countw-functie\/\",\"url\":\"https:\/\/statorials.org\/nl\/sas-countw-functie\/\",\"name\":\"Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-09T23:07:47+00:00\",\"dateModified\":\"2023-07-09T23:07:47+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/sas-countw-functie\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/sas-countw-functie\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/sas-countw-functie\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe de countw-functie in sas te gebruiken (met voorbeeld)\"}]},{\"@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":"Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials","description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.","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-countw-functie\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials","og_description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/sas-countw-functie\/","og_site_name":"Statorials","article_published_time":"2023-07-09T23:07:47+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/seconde-guerre-mondiale.png"}],"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-countw-functie\/","url":"https:\/\/statorials.org\/nl\/sas-countw-functie\/","name":"Hoe de COUNTW-functie in SAS te gebruiken (met voorbeeld) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-09T23:07:47+00:00","dateModified":"2023-07-09T23:07:47+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze zelfstudie wordt uitgelegd hoe u de functie COUNTW in SAS gebruikt om het aantal woorden in een tekenreeks te tellen, met voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/sas-countw-functie\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/sas-countw-functie\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/sas-countw-functie\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe de countw-functie in sas te gebruiken (met voorbeeld)"}]},{"@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\/4579","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=4579"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/4579\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=4579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=4579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=4579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}