<?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: Referencing library or external files using LIBNAME, FILENAME in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429773#M106178</link>
    <description>&lt;P&gt;CARSS as you defined it is a reference. If you do something that writes to the fileref then the content will be created, in most cases replacing the current content depending on how you send output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read from the file, the referenced file will have to exist before attempting to read. Otherwise you will get a "file not found" error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WORK.CARSS would refer to a SAS data set in the work library.&lt;/P&gt;
&lt;P&gt;Your file reference created with the Filename statement is intended to tell SAS where to find external (i.e. typically non-SAS ) files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might use a data step to read that file and create SAS dataset with something similar to:&lt;/P&gt;
&lt;P&gt;data work.carrs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; infile carss &amp;lt;infile options&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;input statement&amp;gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;or perhaps use an import wizard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If "Carss" is supposed to be an existing SAS data set then you would use a LIBNAME statement to assign a library and point to the folder location such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LIBNAME prep '/folders/myfolders/certprep';&lt;/P&gt;
&lt;P&gt;If there are valid SAS data sets then they would be referenced such as PREP.Cars. However the file name you reference is likely not a SAS data set but perhaps a text file you are supposed to read for the exercises?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2018 20:58:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-01-22T20:58:17Z</dc:date>
    <item>
      <title>Referencing library or external files using LIBNAME, FILENAME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429766#M106172</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have started into SAS Certification Prep Guide to prepare myself for SAS Base Certification. I always try to reference library once I start a new SAS session. (NOTE: I use SAS University Edition on my Windows system using Virtual Box and localhost). The problem occurs when I try to reference an external file using FILENAME statement.&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;filename carss&amp;nbsp;'/folders/myfolders/certprep/cardata.dat'&lt;/P&gt;&lt;P&gt;Question:&lt;/P&gt;&lt;P&gt;Does a file name carss should be already present in the library before running this command OR it is created on the fly?&lt;/P&gt;&lt;P&gt;I tried "work.carss" but it is no working as well.&lt;/P&gt;&lt;P&gt;I am really getting confused to&amp;nbsp;referencing as I am using a virtual machine and not the actual environment. I guess it will be different for SAS Enterprise Guide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please clear my knowledge about referencing libraries and files in SAS University Edition.&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 20:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429766#M106172</guid>
      <dc:creator>ronakagrawal</dc:creator>
      <dc:date>2018-01-22T20:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing library or external files using LIBNAME, FILENAME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429770#M106176</link>
      <description>1- FILENAME does not reference libraries. LIBNAME does

2- The path to a library must exist (normally). The path to a file does not have to.

Why do you say there is a problem? 
If it is because you try to use WORK.CARSS then a SAS table (not a file reference created with FILENAME) with that name must exist.</description>
      <pubDate>Mon, 22 Jan 2018 20:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429770#M106176</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-01-22T20:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing library or external files using LIBNAME, FILENAME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429773#M106178</link>
      <description>&lt;P&gt;CARSS as you defined it is a reference. If you do something that writes to the fileref then the content will be created, in most cases replacing the current content depending on how you send output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to read from the file, the referenced file will have to exist before attempting to read. Otherwise you will get a "file not found" error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WORK.CARSS would refer to a SAS data set in the work library.&lt;/P&gt;
&lt;P&gt;Your file reference created with the Filename statement is intended to tell SAS where to find external (i.e. typically non-SAS ) files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might use a data step to read that file and create SAS dataset with something similar to:&lt;/P&gt;
&lt;P&gt;data work.carrs;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; infile carss &amp;lt;infile options&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;lt;input statement&amp;gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;or perhaps use an import wizard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If "Carss" is supposed to be an existing SAS data set then you would use a LIBNAME statement to assign a library and point to the folder location such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LIBNAME prep '/folders/myfolders/certprep';&lt;/P&gt;
&lt;P&gt;If there are valid SAS data sets then they would be referenced such as PREP.Cars. However the file name you reference is likely not a SAS data set but perhaps a text file you are supposed to read for the exercises?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 20:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429773#M106178</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-22T20:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing library or external files using LIBNAME, FILENAME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429786#M106185</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/176912"&gt;@ronakagrawal&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am really getting confused to&amp;nbsp;referencing as I am using a virtual machine and not the actual environment. I guess it will be different for SAS Enterprise Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;EG will be similar to SAS Studio. Both are thin clients that are usually accessing SAS on a Server and you'll still have the same issues accessing files, so encountering this now isn't a bad thing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, you need to first import the data once you have your file reference. The reference only creates a shortcut link to the file, which you then need to import it first, to create a SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find tutorials on&amp;nbsp;&lt;/P&gt;
&lt;P&gt;video.sas.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your question is likely most closely related to this video:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://video.sas.com/detail/videos/how-to-tutorials/video/4573016758001/creating-a-sas-table-from-a-csv-file?autoStart=true" target="_blank"&gt;http://video.sas.com/detail/videos/how-to-tutorials/video/4573016758001/creating-a-sas-table-from-a-csv-file?autoStart=true&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Specific answers to your question:&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Does a file name cars should be already present in the library before running this command OR it is created on the fly?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;It does not need to exist, this is because&amp;nbsp;filename references can also be used as output files. So if you were to export a data set to a text file, you could first create a file reference, but the file doesn't have to pre-exist.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As someone else mentioned, FILENAME and LIBNAME statements are different.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;FILENAME references a file.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A LIBNAME references a folder, usually with SAS data sets. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It can also reference files, specifically files such as XLSX or a database.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 21:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-library-or-external-files-using-LIBNAME-FILENAME/m-p/429786#M106185</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-22T21:15:56Z</dc:date>
    </item>
  </channel>
</rss>

