{"id":3647,"date":"2023-07-16T08:51:12","date_gmt":"2023-07-16T08:51:12","guid":{"rendered":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/"},"modified":"2023-07-16T08:51:12","modified_gmt":"2023-07-16T08:51:12","slug":"sas-indexfunctie","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/","title":{"rendered":"Hoe de index-functie in sas te gebruiken (met voorbeelden)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">U kunt de <b>INDEX-<\/b> functie in SAS gebruiken om de positie te retourneren van de eerste keer dat een tekenreeks in een andere tekenreeks voorkomt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Deze functie gebruikt de volgende basissyntaxis:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>INDEX(bron, uittreksel)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Goud:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>bron<\/strong> : het kanaal dat moet worden geanalyseerd<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>extract<\/strong> : De tekenreeks waarnaar in <em>de bron<\/em> moet worden gezocht<\/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: gebruik van de INDEX-functie in SAS<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Stel dat we de volgende gegevensset in SAS hebben die een kolom met namen bevat:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">\/*create dataset*\/<span style=\"color: #000000;\"><span style=\"color: #800080;\">\ndata<\/span> original_data;\n    <span style=\"color: #3366ff;\">input<\/span> name $25.;\n    <span style=\"color: #3366ff;\">datalines<\/span> ;\nAndy Lincoln Bernard\nMichael Smith\nChad Simpson Arnolds\nDerrick Smith Henrys\nEric Millerton Smith\nFrank Giovanni Goode\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> = original_data;<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-29929 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice1.jpg\" alt=\"\" width=\"210\" height=\"192\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">We kunnen de <strong>INDEX-<\/strong> functie gebruiken om de positie te vinden van de eerste keer dat de string &#8222;Smith&#8220; in elke regel voorkomt:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\"><span style=\"color: #008000;\">\/*find position of first occurrence of 'Smith' in name*\/\n<span style=\"color: #000000;\"><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> original_data;\n    first_smith = <span style=\"color: #3366ff;\">index<\/span> (name, ' <span style=\"color: #800080;\">Smith<\/span> ');\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view results*\/\n<\/span><span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> = new_data;\n<\/span><\/span><\/span><\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-29930 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice2.jpg\" alt=\"\" width=\"311\" height=\"197\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">De nieuwe kolom genaamd <strong>first_smith<\/strong> geeft de positie weer van de eerste keer dat de string &#8218;Smith&#8216; voorkomt in de <strong>naamkolom<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Als &#8218;Smith&#8216; helemaal niet wordt gevonden, retourneert de functie <strong>INDEX<\/strong> eenvoudigweg de waarde <strong>0<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Het is belangrijk op te merken dat de <strong>INDEX-<\/strong> functie hoofdlettergevoelig is, dus als u in plaats daarvan naar &#8222;smith&#8220; zoekt, retourneert de <strong>INDEX-<\/strong> functie <strong>0<\/strong> voor elke tekenreeks:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\"><span style=\"color: #008000;\">\/*find position of first occurrence of 'smith' in name*\/\n<span style=\"color: #000000;\"><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> original_data;\n    first_smith = <span style=\"color: #3366ff;\">index<\/span> (name, ' <span style=\"color: #800080;\">smith<\/span> ');\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view results*\/\n<\/span><span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> = new_data;<\/span><\/span><\/span><\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-29931 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice3.jpg\" alt=\"\" width=\"311\" height=\"207\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Om een hoofdletterongevoelige zoekopdracht uit te voeren, kunt u de functie <a href=\"https:\/\/statorials.org\/nl\/sas-hoofdletter-kleine-letter-eigen-letter\/\" target=\"_blank\" rel=\"noopener\">lowcase()<\/a> gebruiken om eerst elke tekenreeks naar kleine letters te converteren en vervolgens als volgt naar &#8222;smith&#8220; te zoeken:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\"><span style=\"color: #008000;\">\/*find position of first occurrence of 'smith' in name*\/\n<span style=\"color: #000000;\"><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> original_data;\n    first_smith = <span style=\"color: #3366ff;\">index<\/span> ( <span style=\"color: #3366ff;\">lowcase<\/span> (name), ' <span style=\"color: #800080;\">smith<\/span> ');\n<span style=\"color: #800080;\">run<\/span> ;\n\n<span style=\"color: #008000;\">\/*view results*\/<\/span>\n<span style=\"color: #800080;\">proc print<\/span> <span style=\"color: #3366ff;\">data<\/span> = new_data;<\/span><\/span><\/span><\/strong><\/span> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-29930 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice2.jpg\" alt=\"\" width=\"305\" height=\"193\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">Door elke tekenreeks eerst naar kleine letters te converteren, kunnen we de <strong>INDEX-<\/strong> functie gebruiken om een hoofdletterongevoelige zoekopdracht uit te voeren.<\/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 functies in SAS kunt gebruiken:<\/span><\/p>\n<p> <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\/compressiefunctie-voor-luchtsluis\/\" target=\"_blank\" rel=\"noopener\">Hoe de COMPRESS-functie in SAS te gebruiken<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/sas-zoekfunctie\/\" target=\"_blank\" rel=\"noopener\">Hoe de FIND-functie in SAS te gebruiken<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/niet-samenvoegen\/\" target=\"_blank\" rel=\"noopener\">Hoe de COALESCE-functie in SAS te gebruiken<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>U kunt de INDEX- functie in SAS gebruiken om de positie te retourneren van de eerste keer dat een tekenreeks in een andere tekenreeks voorkomt. Deze functie gebruikt de volgende basissyntaxis: INDEX(bron, uittreksel) Goud: bron : het kanaal dat moet worden geanalyseerd extract : De tekenreeks waarnaar in de bron moet worden gezocht Het volgende [&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-3647","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 INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials<\/title>\n<meta name=\"description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende 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-indexfunctie\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende voorbeelden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/sas-indexfunctie\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-16T08:51:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice1.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-indexfunctie\/\",\"url\":\"https:\/\/statorials.org\/nl\/sas-indexfunctie\/\",\"name\":\"Hoe de INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-16T08:51:12+00:00\",\"dateModified\":\"2023-07-16T08:51:12+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende voorbeelden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/sas-indexfunctie\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/sas-indexfunctie\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/sas-indexfunctie\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe de index-functie in sas te gebruiken (met voorbeelden)\"}]},{\"@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 INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials","description":"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende 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-indexfunctie\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials","og_description":"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende voorbeelden.","og_url":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/","og_site_name":"Statorials","article_published_time":"2023-07-16T08:51:12+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/indice1.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-indexfunctie\/","url":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/","name":"Hoe de INDEX-functie in SAS te gebruiken (met voorbeelden) - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-16T08:51:12+00:00","dateModified":"2023-07-16T08:51:12+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze zelfstudie wordt uitgelegd hoe u de INDEX-functie in SAS gebruikt, met verschillende voorbeelden.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/sas-indexfunctie\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/sas-indexfunctie\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe de index-functie in sas te gebruiken (met voorbeelden)"}]},{"@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\/3647","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=3647"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/3647\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=3647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=3647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=3647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}