title: SAS: Set current folder to the folder containing the running program
body: <p>I've just started learning SAS because I'm required to use it for a statistics course.  For this course, the university provides SAS 9.2 through their virtual-machine setup:  I make a reservation in their system, they generate a VM on one of their servers, and I connect to the VM using Microsoft's Remote Desktop client.  The virtual machines are generated and erased per session; settings are reset every time, and files must be stored on my client computer (which is accessible in the VM by a UNC path).</p>
  
  <p>Within this setup, when I open a program file stored on my laptop, I've only been able to access the accompanying data files (each stored in the same folder as the program) either by hardcoding the full path or by updating the "current folder" setting at the beginning of each session.  The first is problematic because it means the program won't run anywhere else - in particular, when I email it to the professor.  The second is inconvenient, because browsing to this particular UNC path is time consuming, and I already have to browse to the same path to open the program file.</p>
  
  <p>I want to make this easier by programmatically setting the current folder to the folder containing the program.  Then I could just open the file and get to work.  I've found some examples of <a href="http://www.sascommunity.org/wiki/Get_Name_of_Program" rel="noreferrer">getting the filename of the program file</a>, of <a href="http://www.sascommunity.org/wiki/Tips:Using_PATHNAME_to_Retrieve_a_Physical_Path" rel="noreferrer">getting the path to a fileref</a>, and of (link limit exceeded) setting the current folder, but I haven't been able to combine them in the right way.  Please connect the dots for me.</p>