<?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: Read SAS File With Path in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718186#M222215</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;...&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="6" color="#339966"&gt;The preferred method is always to use a defined LIBNAME&lt;/FONT&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just wanted to a minor emphasis on the preferred way to access datasets. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310443"&gt;@psrajput&lt;/a&gt;: Forget the other method, it will cause trouble sooner than one expects.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Feb 2021 11:21:27 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-02-10T11:21:27Z</dc:date>
    <item>
      <title>Read SAS File With Path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718161#M222201</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we read the SAS file along with the folder path?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/sas/abc/bcd/sasfile.sas7bdat&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 09:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718161#M222201</guid>
      <dc:creator>psrajput</dc:creator>
      <dc:date>2021-02-10T09:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Read SAS File With Path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718166#M222204</link>
      <description>&lt;P&gt;You can see my topic here. At the end of the day, you must create or relate to a libref..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-call-a-sas7bdat-file-directly-without-referring-the/m-p/717717#M221989" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-call-a-sas7bdat-file-directly-without-referring-the/m-p/717717#M221989&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I will suggest it is a good idea to refer to a directory rather than the file physically itself per se.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; said:&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;You can use the same syntax with any other place where you would reference a dataset.&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;proc means data="C:\downloads\class"; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice that under the hood SAS will actually create a libref that points to that directory. Example:&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;proc contents data="C:\downloads\class" out=contents; run;
proc print data=contents;
  var libname memname name type length ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    LIBNAME     MEMNAME    NAME      TYPE    LENGTH

 1     WC000001     CLASS     Age         1        8
 2     WC000001     CLASS     Height      1        8
 3     WC000001     CLASS     Name        2        8
 4     WC000001     CLASS     Sex         2        1
 5     WC000001     CLASS     Weight      1        8
&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Now once you have referenced the file a specific libref will exist and you could use it to reference the dataset instead as long as you are in the same SAS session.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;proc means data=WC000001.class; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;But if you prefer to use the normal libname.memname syntax then it is better to write your own LIBNAME statement so that you have control over the libref that is used as there is not really anyway to know in advance what libref will be generated by using the quoted physical filename syntax.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So use something like this instead:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;libname mydata "C:\downloads" ;
proc contents data=mydata.class; 
run;
proc means data=mydata.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 09:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718166#M222204</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-10T09:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Read SAS File With Path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718167#M222205</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data "/folders/myfolders/class.sas7bdat";
set sashelp.class;
run;

data class;
set "/folders/myfolders/class.sas7bdat";
run;

libname myfold '/folders/myfolders';

data class;
set myfold.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The preferred method is always to use a defined LIBNAME.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 09:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718167#M222205</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-10T09:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Read SAS File With Path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718186#M222215</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;...&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="6" color="#339966"&gt;The preferred method is always to use a defined LIBNAME&lt;/FONT&gt;.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just wanted to a minor emphasis on the preferred way to access datasets. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310443"&gt;@psrajput&lt;/a&gt;: Forget the other method, it will cause trouble sooner than one expects.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 11:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-SAS-File-With-Path/m-p/718186#M222215</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-10T11:21:27Z</dc:date>
    </item>
  </channel>
</rss>

