<?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 refer to a data file in the same folder without the full path? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644441#M21975</link>
    <description>&lt;P&gt;Thank you, Reeza.&lt;/P&gt;&lt;P&gt;I also found a macro to find current directory path:&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Find-current-directory-path/ta-p/485785" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Find-current-directory-path/ta-p/485785&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But it doesn't seem to work with University Edition, which runs on a virtual machine.&lt;/P&gt;&lt;P&gt;I got:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Consolas,Courier,'Courier New'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;curdir = /opt/sasinside/SASConfig/Lev1/SASApp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Consolas,Courier,'Courier New'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;which I have no idea about.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;</description>
    <pubDate>Fri, 01 May 2020 03:08:18 GMT</pubDate>
    <dc:creator>LarryWang</dc:creator>
    <dc:date>2020-05-01T03:08:18Z</dc:date>
    <item>
      <title>How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644420#M21970</link>
      <description>&lt;P&gt;I'm new to SAS but have other programming background&lt;/P&gt;&lt;P&gt;University Edition in Windows.&lt;/P&gt;&lt;P&gt;I realized that if I use&lt;/P&gt;&lt;P&gt;infile '/folders/myfolders/cody/learn/bankdata.txt';&lt;/P&gt;&lt;P&gt;the program won't work if I change any of the folder names, or if I move the .sas and .txt files together to a different folder.&lt;/P&gt;&lt;P&gt;Is there a way to refer to the data file in the same folder without using the full physical path?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;P.S. I've searched around a bit but in vain.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 00:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644420#M21970</guid>
      <dc:creator>LarryWang</dc:creator>
      <dc:date>2020-05-01T00:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644431#M21973</link>
      <description>&lt;P&gt;SAS doesn't have a great concept of working directories like other programming languages (R/Python) are the comparisons.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead you can set macro variables though that can be reused easily.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I put this at the top of my programs:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let working_dir = /folders/myfolders/learn/;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use it as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile "&amp;amp;working_dir/bankdata.txt";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For macro variables you need to use double quotes and consider it exact text replacement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a quick tutorial on it, but I highly recommend learning data steps first and other options.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Examples of common macro usage&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 01:49:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644431#M21973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-01T01:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644441#M21975</link>
      <description>&lt;P&gt;Thank you, Reeza.&lt;/P&gt;&lt;P&gt;I also found a macro to find current directory path:&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Find-current-directory-path/ta-p/485785" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Find-current-directory-path/ta-p/485785&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But it doesn't seem to work with University Edition, which runs on a virtual machine.&lt;/P&gt;&lt;P&gt;I got:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Consolas,Courier,'Courier New'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;curdir = /opt/sasinside/SASConfig/Lev1/SASApp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Consolas,Courier,'Courier New'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;which I have no idea about.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 03:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644441#M21975</guid>
      <dc:creator>LarryWang</dc:creator>
      <dc:date>2020-05-01T03:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644448#M21976</link>
      <description>&lt;P&gt;That post doesn't answer your question as far as I understand it and your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A quick google search came up with this though, which means that the working directory issue in SAS is gone to some degree. One issue is that SAS _may_ output temporary files to the same location so you'll need to be careful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2018/05/18/how-to-change-your-working-directory-for-sas-with-the-dlgcdir-data-step-function/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2018/05/18/how-to-change-your-working-directory-for-sas-with-the-dlgcdir-data-step-function/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 03:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644448#M21976</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-01T03:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644452#M21977</link>
      <description>&lt;P&gt;Thanks, again.&amp;nbsp; I think both methods would help address my initial request, in a regular version of SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There seem to be limitations on how I can access folders in the Univ Edition.&amp;nbsp; DLGCDIR wouldn't work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Larry&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 03:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644452#M21977</guid>
      <dc:creator>LarryWang</dc:creator>
      <dc:date>2020-05-01T03:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644545#M21979</link>
      <description>&lt;P&gt;The method I initially posted works fine in SAS UE - I've used it many times.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 15:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644545#M21979</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-01T15:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to refer to a data file in the same folder without the full path?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644553#M21983</link>
      <description>&lt;P&gt;Actually I just tried both and they work fine in SAS UE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS UE is more like working with a SAS server edition that doesn't have access to your local drive except through your shared folder, in this case the myfolders folder or any additional shared folders you created.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
rc = dlgcdir("/folders/myfolders");
put rc;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And check the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 15:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-refer-to-a-data-file-in-the-same-folder-without-the-full/m-p/644553#M21983</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-01T15:52:52Z</dc:date>
    </item>
  </channel>
</rss>

