<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to read in SAV file and save as csv? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841304#M36473</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;library(haven)
library(readr)
HNIR62FL_data_2 &amp;lt;-
read_sav("C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\Original Data Set")
write_csv(x=HNIR62FL_data_2, path="C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\CSV.csv")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;These are not SAS statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no library statement or function in SAS. There is a LIBNAME command, which looks nothing like the library statement you show and would not be needed to read a file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, the rest of your code also does not use SAS statements or SAS functions.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 13:34:12 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-10-28T13:34:12Z</dc:date>
    <item>
      <title>How to read in SAV file and save as csv?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841302#M36472</link>
      <description>&lt;P&gt;I'm trying to read a SAV file into SAS then write it as CSV. Below is an example of what someone gave me to do. What they gave me is in bold.&amp;nbsp; I only changed the file path names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;library(haven) &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;library(readr) &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;HNIR62FL_data_2 &amp;lt;- &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;read_sav&lt;/STRONG&gt;("C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\Original Data Set")&lt;BR /&gt;&lt;STRONG&gt;write_csv(x=HNIR62FL_data_2, path=&lt;/STRONG&gt;"C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\CSV.csv")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an error message when I ran the above. The error message is:&lt;/P&gt;&lt;P&gt;16 library(haven)&lt;BR /&gt;-------&lt;BR /&gt;180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;17 library(readr)&lt;BR /&gt;18 HNIR62FL_data_2 &amp;lt;-&lt;BR /&gt;19 read_sav("C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\Original Data Set")&lt;BR /&gt;20 write_csv(x=HNIR62FL_data_2, path="C:\Users\gtuck\OneDrive\Documents\Gretchen&lt;BR /&gt;20 ! Dissertation\SAS\CSV.csv")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what I need to do. What does the two library names mean? Can they be called anything? What is the HNIR62FL_data_2&amp;lt;- for?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841302#M36472</guid>
      <dc:creator>gtucke1</dc:creator>
      <dc:date>2022-10-28T13:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to read in SAV file and save as csv?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841304#M36473</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;library(haven)
library(readr)
HNIR62FL_data_2 &amp;lt;-
read_sav("C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\Original Data Set")
write_csv(x=HNIR62FL_data_2, path="C:\Users\gtuck\OneDrive\Documents\Gretchen Dissertation\SAS\CSV.csv")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;These are not SAS statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no library statement or function in SAS. There is a LIBNAME command, which looks nothing like the library statement you show and would not be needed to read a file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Similarly, the rest of your code also does not use SAS statements or SAS functions.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841304#M36473</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-28T13:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to read in SAV file and save as csv?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841305#M36474</link>
      <description>&lt;P&gt;Why are you trying to run R code in SAS?&lt;/P&gt;
&lt;P&gt;What is a SAV file?&amp;nbsp; Do you mean you have an SPSS dataset?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 13:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841305#M36474</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-28T13:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to read in SAV file and save as csv?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841323#M36475</link>
      <description>That's R code, not SAS. &lt;BR /&gt;&lt;BR /&gt;You can do this in SAS though.&lt;BR /&gt;&lt;BR /&gt;proc import datafile = "c:\data\hsb2.sav" out= work.hsb2;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc export data=hsb2 outfile='C:\data/hsb2.csv' dbms=csv replace;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 28 Oct 2022 15:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-in-SAV-file-and-save-as-csv/m-p/841323#M36475</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-28T15:42:07Z</dc:date>
    </item>
  </channel>
</rss>

