<?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 Can I write a data set to a sasuser subfolder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925436#M364196</link>
    <description>&lt;P&gt;This is a beginner question, as I have been working with SAS only on and off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I work mostly in the 'work' folder and send to sasuser as needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I searched around the help forums after the below bombed and did not find anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to send to a subfolder?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data sasuser.subfolder.have;
set work.have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Apr 2024 19:16:31 GMT</pubDate>
    <dc:creator>yelkenli</dc:creator>
    <dc:date>2024-04-23T19:16:31Z</dc:date>
    <item>
      <title>Can I write a data set to a sasuser subfolder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925436#M364196</link>
      <description>&lt;P&gt;This is a beginner question, as I have been working with SAS only on and off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I work mostly in the 'work' folder and send to sasuser as needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I searched around the help forums after the below bombed and did not find anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to send to a subfolder?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data sasuser.subfolder.have;
set work.have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2024 19:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925436#M364196</guid>
      <dc:creator>yelkenli</dc:creator>
      <dc:date>2024-04-23T19:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I write a data set to a sasuser subfolder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925442#M364199</link>
      <description>&lt;P&gt;Just make the directory before hand and then define a different libref that points to the new directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume your SASUSER libref is configured to point to the directory ~/sasuser.v94 (typical on Unix installs of Foundation SAS).&amp;nbsp; So first create a new directory, let's call it ~/sasuser.v94/subdir.&amp;nbsp; Then in your SAS program define a libref that points to it.&amp;nbsp; Let's use the libref SUBDIR.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname subdir "~/sasuser.v94/subdir";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can reference SAS datasets in that directory by using a normal two level name with SUBDIR as the libref and the dataset name as the member name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data subdir.have;
  set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Personally I never write anything into SASUSER libref because when you have more than one SAS job running (and who doesn't if they are really using SAS for production work?) then you cannot get write access to it in all of them.&amp;nbsp; &amp;nbsp;So instead just point your libref to some other more meaningful directory.&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname proj1 '~/project1';
libname proj2 '~/project2';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 19:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925442#M364199</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-04-23T19:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can I write a data set to a sasuser subfolder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925444#M364201</link>
      <description>&lt;P&gt;The elements of a fully-qualified table reference in SAS don't correlate to physical folders in the file system. So, if you have write access to the SASUSER library, it's possible to create a subfolder there, you'd need to assign a different libref instead of using three-level notation. If that's what you want, then you could go about it like this (examples were tested using PC SAS):&lt;BR /&gt;1. Identify the physical location of the SASUSER library. The PATHNAME function can do that for you:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put NOTE: The SASUSER library is located in %qsysfunc(pathname(sasuser));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the log:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;NOTE: The SASUSER library is located in C:\Users\myUserID\Documents\My SAS Files\9.4&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;amp;nbsp&lt;/P&gt;
&lt;P&gt;You can use the DLCREATEDIR option to make SAS create a folder in the file system when assigning a libref, if the folder does not exist:&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;
LIBNAME SUB "%qsysfunc(pathname(sasuser))\mySubFolder";
options nodlcreatedir;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From the log:&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;NOTE: Library SUB was created.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;NOTE: Libref SUB was successfully assigned as follows:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Engine: V9&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Physical Name: C:\Users\myUserID\Documents\My SAS Files\9.4\mySubFolder&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;Now, data sets written to the SUB library will be stored in the new&amp;nbsp;&lt;STRONG&gt;mySubFolder&lt;/STRONG&gt; folder.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sub.have;
	set work.have;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 19:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-write-a-data-set-to-a-sasuser-subfolder/m-p/925444#M364201</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-04-23T19:55:57Z</dc:date>
    </item>
  </channel>
</rss>

