{"id":4223,"date":"2023-07-12T18:09:00","date_gmt":"2023-07-12T18:09:00","guid":{"rendered":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/"},"modified":"2023-07-12T18:09:00","modified_gmt":"2023-07-12T18:09:00","slug":"senza-rimuovere-lultimo-carattere-dalla-stringa","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/","title":{"rendered":"Sas: come rimuovere l&#39;ultimo carattere da una stringa"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Il modo pi\u00f9 semplice per rimuovere l&#8217;ultimo carattere da una stringa in SAS \u00e8 utilizzare la funzione <a href=\"https:\/\/statorials.org\/it\/sotto-la-funzione-airlock\/\" target=\"_blank\" rel=\"noopener\">SUBSTR<\/a> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Per fare ci\u00f2, \u00e8 possibile utilizzare la seguente sintassi di base:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\">data<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> original_data;\n    string_var = <span style=\"color: #3366ff;\">substr<\/span> (string_var, <span style=\"color: #008000;\">1<\/span> , <span style=\"color: #3366ff;\">length<\/span> (string_var)- <span style=\"color: #008000;\">1<\/span> );\n<span style=\"color: #800080;\">run<\/span> ;\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Questa sintassi estrae la sottostringa a partire dal primo carattere fino al penultimo carattere della stringa, che ha l&#8217;effetto di rimuovere l&#8217;ultimo carattere dalla stringa.<\/span><\/p>\n<p> <span style=\"color: #000000;\">L&#8217;esempio seguente mostra come utilizzare questa sintassi nella pratica.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Esempio: rimuovere l&#8217;ultimo carattere dalla stringa in SAS<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Supponiamo di avere il seguente set di dati in SAS che contiene informazioni su varie squadre di basket:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #800080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">\/*create dataset*\/\n<\/span><span style=\"color: #800080;\">data<\/span> my_data;\n    <span style=\"color: #3366ff;\">input<\/span> team $points;\n    <span style=\"color: #3366ff;\">datalines<\/span> ;\nMavsx 113\nPacersx95\nCavsx 120\nLakersx 114\nHeatx 123\nKingsx 119\nRaptorsx 105\nHawksx 95\nMagicx 103\nSpursx 119\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;<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-33400 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/dernier11.jpg\" alt=\"\" width=\"191\" height=\"299\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che ogni stringa nella colonna <strong>della squadra<\/strong> contiene una x come ultimo carattere.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Possiamo usare la funzione <strong>SUBSTR<\/strong> per rimuovere quest&#8217;ultimo carattere da ogni stringa nella colonna della <strong>squadra<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #800080;\"><span style=\"color: #008000;\">\/*create new dataset where last character in each string of team column is removed*\/<\/span>\ndata<\/span> new_data;\n    <span style=\"color: #3366ff;\">set<\/span> my_data;\n    team = <span style=\"color: #000000;\"><span style=\"color: #3366ff;\">substr<\/span> (string_var, <span style=\"color: #008000;\">1<\/span> , <span style=\"color: #3366ff;\">length<\/span> (string_var)- <span style=\"color: #008000;\">1<\/span> );<\/span>\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;\n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-33396 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sous-titre2.jpg\" alt=\"\" width=\"193\" height=\"303\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che l&#8217;ultimo carattere di ciascuna stringa nella colonna <strong>della squadra<\/strong> \u00e8 stato rimosso.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Tieni presente che la funzione <strong>SUBSTR<\/strong> utilizza la seguente sintassi di base:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>SUBSTR(Origine, Posizione, N)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Oro:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Sorgente<\/strong> : il canale da analizzare<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Posizione<\/strong> : la posizione iniziale da leggere<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>N<\/strong> : Il numero di caratteri da leggere<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Utilizzando <strong>substr(team, 1, length(team)-1)<\/strong> possiamo estrarre la sottostringa di ogni stringa nella colonna <strong>team<\/strong> a partire dal primo carattere fino al penultimo carattere.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Ci\u00f2 ha l&#8217;effetto di rimuovere l&#8217;ultimo carattere dalla stringa.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come eseguire altre attivit\u00e0 comuni in SAS:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/numero-del-canale-di-estrazione-sas\/\" target=\"_blank\" rel=\"noopener\">Come estrarre numeri da una stringa in SAS<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/sotto-la-funzione-airlock\/\" target=\"_blank\" rel=\"noopener\">Come utilizzare la funzione SUBSTR in SAS<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/non-rimuovere-i-caratteri-speciali\/\" target=\"_blank\" rel=\"noopener\">Come rimuovere caratteri speciali dalle stringhe in SAS<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Il modo pi\u00f9 semplice per rimuovere l&#8217;ultimo carattere da una stringa in SAS \u00e8 utilizzare la funzione SUBSTR . Per fare ci\u00f2, \u00e8 possibile utilizzare la seguente sintassi di base: data new_data; set original_data; string_var = substr (string_var, 1 , length (string_var)- 1 ); run ; Questa sintassi estrae la sottostringa a partire dal primo [&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":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SAS: Come rimuovere l&#039;ultimo carattere da una stringa \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come rimuovere l&#039;ultimo carattere da una stringa in SAS, con un esempio.\" \/>\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\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SAS: Come rimuovere l&#039;ultimo carattere da una stringa \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come rimuovere l&#039;ultimo carattere da una stringa in SAS, con un esempio.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-12T18:09:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/dernier11.jpg\" \/>\n<meta name=\"author\" content=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/\",\"url\":\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/\",\"name\":\"SAS: Come rimuovere l&#39;ultimo carattere da una stringa \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-12T18:09:00+00:00\",\"dateModified\":\"2023-07-12T18:09:00+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come rimuovere l&#39;ultimo carattere da una stringa in SAS, con un esempio.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sas: come rimuovere l&#39;ultimo carattere da una stringa\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SAS: Come rimuovere l&#39;ultimo carattere da una stringa \u2013 Statorials","description":"Questo tutorial spiega come rimuovere l&#39;ultimo carattere da una stringa in SAS, con un esempio.","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\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/","og_locale":"it_IT","og_type":"article","og_title":"SAS: Come rimuovere l&#39;ultimo carattere da una stringa \u2013 Statorials","og_description":"Questo tutorial spiega come rimuovere l&#39;ultimo carattere da una stringa in SAS, con un esempio.","og_url":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/","og_site_name":"Statorials","article_published_time":"2023-07-12T18:09:00+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/dernier11.jpg"}],"author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/","url":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/","name":"SAS: Come rimuovere l&#39;ultimo carattere da una stringa \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-12T18:09:00+00:00","dateModified":"2023-07-12T18:09:00+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come rimuovere l&#39;ultimo carattere da una stringa in SAS, con un esempio.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/senza-rimuovere-lultimo-carattere-dalla-stringa\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Sas: come rimuovere l&#39;ultimo carattere da una stringa"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4223"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=4223"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/4223\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=4223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=4223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=4223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}