{"id":1997,"date":"2023-07-24T03:53:02","date_gmt":"2023-07-24T03:53:02","guid":{"rendered":"https:\/\/statorials.org\/it\/import-sas-in-r\/"},"modified":"2023-07-24T03:53:02","modified_gmt":"2023-07-24T03:53:02","slug":"import-sas-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/import-sas-in-r\/","title":{"rendered":"Come importare file sas in r (passo dopo passo)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Il modo pi\u00f9 semplice per importare file SAS in R \u00e8 utilizzare la funzione <strong>read_sas()<\/strong> dalla libreria <a href=\"https:\/\/haven.tidyverse.org\/reference\/read_sas.html\" target=\"_blank\" rel=\"noopener\">Haven<\/a> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Questa funzione utilizza la seguente sintassi di base:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>data &lt;- read_sas( <span style=\"color: #000000;\">' <span style=\"color: #ff0000;\">C:\/Users\/User_Name\/file_name.sas7bdat<\/span> ')<\/span>\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Il seguente esempio passo passo mostra come importare nella pratica un file SAS in R.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Passaggio 1: scarica un file di dati SAS<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Per questo esempio, scaricheremo il file SAS chiamato <strong>cola.sas7bdat<\/strong> da <a href=\"https:\/\/www.principlesofeconometrics.com\/sas.htm\" target=\"_blank\" rel=\"noopener\">questa pagina<\/a> .<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-18784 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sasimport1.png\" alt=\"\" width=\"584\" height=\"517\" srcset=\"\" sizes=\"\"><\/p>\n<h3> <strong><span style=\"color: #000000;\">Passaggio 2: installa il pacchetto Haven<\/span><\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Successivamente, installeremo il pacchetto Haver in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #000000;\">install. <span style=\"color: #3366ff;\">packages<\/span> (' <span style=\"color: #ff0000;\">haven<\/span> ')<\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Successivamente caricheremo il pacchetto:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><b><span style=\"color: #993300;\">library<\/span> (haven)<\/b><\/span><\/pre>\n<h3> <strong><span style=\"color: #000000;\">Passaggio 3: importa il file SAS<\/span><\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Successivamente, utilizzeremo la funzione <strong>read_sas()<\/strong> per importare il file SAS:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong>data &lt;- read_sas(' <span style=\"color: #ff0000;\">C:\/Users\/bob\/Downloads\/cola.sas7bdat<\/span> ')<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Una volta importato il file SAS, possiamo<\/span> ottenere un breve riepilogo dei dati:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><b><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#view class of data<\/span>\nclass(data)\n\n[1] \"tbl_df\" \"tbl\" \"data.frame\"<\/span>\n\n#display dimensions of data frame<\/span>\ndim(data)\n\n[1] 5466 5\n\n<span style=\"color: #008080;\">#view first six rows of data<\/span>\nhead(data)\n\n     ID CHOICE PRICE FEATURE DISPLAY\n1 1 0 1.79 0 0\n2 1 0 1.79 0 0\n3 1 1 1.79 0 0\n4 2 0 1.79 0 0\n5 2 0 1.79 0 0\n6 2 1 0.890 1 1\n<\/b><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Possiamo vedere che il file \u00e8 stato importato con successo come frame di dati e ha <strong>5<\/strong> colonne e <strong>5.466<\/strong> righe.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come importare altri tipi di file in R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/importare-csv-in-r\/\" target=\"_blank\" rel=\"noopener\">Come importare file CSV in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/importare-excel-in-r\/\" target=\"_blank\" rel=\"noopener\">Come importare file Excel in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/importare-il-file-di-dati-in-r\/\" target=\"_blank\" rel=\"noopener\">Come importare file .dta in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/importa-il-file-spss-in-r\/\" target=\"_blank\" rel=\"noopener\">Come importare file SPSS in R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Il modo pi\u00f9 semplice per importare file SAS in R \u00e8 utilizzare la funzione read_sas() dalla libreria Haven . Questa funzione utilizza la seguente sintassi di base: data &lt;- read_sas( &#8216; C:\/Users\/User_Name\/file_name.sas7bdat &#8216;) Il seguente esempio passo passo mostra come importare nella pratica un file SAS in R. Passaggio 1: scarica un file di dati [&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>Come importare file SAS in R (passo dopo passo) \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.\" \/>\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\/import-sas-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come importare file SAS in R (passo dopo passo) \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/import-sas-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T03:53:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sasimport1.png\" \/>\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=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/import-sas-in-r\/\",\"url\":\"https:\/\/statorials.org\/it\/import-sas-in-r\/\",\"name\":\"Come importare file SAS in R (passo dopo passo) \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-24T03:53:02+00:00\",\"dateModified\":\"2023-07-24T03:53:02+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/import-sas-in-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/import-sas-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/import-sas-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come importare file sas in r (passo dopo passo)\"}]},{\"@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":"Come importare file SAS in R (passo dopo passo) \u2013 Statorials","description":"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.","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\/import-sas-in-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come importare file SAS in R (passo dopo passo) \u2013 Statorials","og_description":"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.","og_url":"https:\/\/statorials.org\/it\/import-sas-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-24T03:53:02+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/sasimport1.png"}],"author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/import-sas-in-r\/","url":"https:\/\/statorials.org\/it\/import-sas-in-r\/","name":"Come importare file SAS in R (passo dopo passo) \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-24T03:53:02+00:00","dateModified":"2023-07-24T03:53:02+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come importare un file SAS in R, con un esempio passo passo.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/import-sas-in-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/import-sas-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/import-sas-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come importare file sas in r (passo dopo passo)"}]},{"@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\/1997"}],"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=1997"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/1997\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=1997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=1997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=1997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}