<?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: Prevent SAS from storing data in Work Folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671755#M201764</link>
    <description>&lt;P&gt;Why do you think that SAS is still using the WORK folder?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jul 2020 10:59:13 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-07-23T10:59:13Z</dc:date>
    <item>
      <title>Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671753#M201762</link>
      <description>&lt;P&gt;Good Day.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am trying to merge 2 SAS datasets, one of which is ~100MB in size and the other ranges between 400 - 700GB per dataset. The code I'm using to do this looks similar to the below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname dsfirst "\\path\to\first_dataset";
libname destfp "\\destination_path";

proc sql;
 create table destfp.merge_20200131 as
 select a.person_id, b.*
 from dsfirst.firstds_202001 a left join destfp.secondds_20200131 b on 
 a.person_id = b.id_no;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The second dataset is currently saved in the destination file path, &lt;STRONG&gt;destfp.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to the size of the second dataset, I was hoping to circumvent writing data to the Work folder/drive on the SAS Workspace server that the code is running on as this is not big enough to house the resultant dataset, however SAS is still writing to this Work folder in spite of the above code. Any ideas why this is the case, and is there a way to avoid this? Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 10:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671753#M201762</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-23T10:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671755#M201764</link>
      <description>&lt;P&gt;Why do you think that SAS is still using the WORK folder?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 10:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671755#M201764</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-23T10:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671756#M201765</link>
      <description>What size of the result you are expecting? Will it be close to "100MB" of the first or "400GB" of the second?&lt;BR /&gt;Bart</description>
      <pubDate>Thu, 23 Jul 2020 11:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671756#M201765</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-07-23T11:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671757#M201766</link>
      <description>I would suspect that maybe utiliti files are stored there?</description>
      <pubDate>Thu, 23 Jul 2020 11:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671757#M201766</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-07-23T11:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671758#M201767</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; I honestly have no idea. I suspect it could be a configuration we are missing, but my SAS Server Administration knowledge is currently limited.</description>
      <pubDate>Thu, 23 Jul 2020 11:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671758#M201767</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-23T11:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671760#M201769</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt; I'm expecting it to be at least 400GB, depending on the size of the second dataset.</description>
      <pubDate>Thu, 23 Jul 2020 11:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671760#M201769</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-23T11:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671761#M201770</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/319244"&gt;@SGcabashe1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; I honestly have no idea. I suspect it could be a configuration we are missing, but my SAS Server Administration knowledge is currently limited.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This does not answer the question. You stated definitively that data sets were being written to the WORK folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;however SAS is still writing to this Work folder&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What do you see that makes you say this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671761#M201770</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-23T11:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671762#M201771</link>
      <description>&lt;P&gt;What is data structure of both sets, i.e. number of observations and variables? what is relation between `person_id` and `id_no`? is it 1-to-1? or 1-to-n?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671762#M201771</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-07-23T11:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671764#M201773</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; my apologies. When the session is active, it creates files in my user folder in the Work folder, which are typically greater than or equal to the size of the second dataset. Left unchecked, this then results in the "Disk Full/OUT OF RESOURCES" error message. This occurs irrespective of the free space in destfp, the destination file path.</description>
      <pubDate>Thu, 23 Jul 2020 11:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671764#M201773</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-23T11:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671773#M201777</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt; Dataset 1 typically has &amp;gt;17000 observations and 170 variables. Dataset 2 typically has between 40000000 and 50000000 observations and 7820 variables. As for the relation, it's 1-to-n - person_id from Dataset 1 can appear 1 or more times in Dataset 2.</description>
      <pubDate>Thu, 23 Jul 2020 11:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671773#M201777</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-23T11:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671780#M201780</link>
      <description>&lt;P&gt;Using SQL for joins will always cause the creation of utility files in WORK, which can grow to considerable size; see Maxim 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To determine which method is most feasible to solve your issue, we need to get to Know Your Data (Maxim 3). Please supply information about number of observations involved in your join, and about the key relationship (1:1, 1:many, many:1, many:many).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My first idea would be this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data destfp.merge_20200131_a;
set destfp.secondds_20200131;
if _n_ = 1
then do;
  person_id = id_no; /* just to set the attributes */
  declare hash first (dataset:"dsfirst.firstds_202001 (keep=person_id)");
  first.definekey('person_id');
  first.definedata('person_id');
  first.definedone();
end;
if first.check(key:id_no) = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you can fit the hash into memory, then there is a very good chance you can now sort the tables, and use a MERGE to get the left join:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=destfp.merge_20200131_a;
by person_id;
run;

proc sort data=dsfirst.firstds_202001
by person_id;
run;

data destfp.merge_20200131;
merge
  dsfirst.firstds_202001 (keep=person_id in=a)
  destfp.merge_20200131_a
;
by person_id;
if a;
run;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code is not tested, for lack of example data to test against.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671780#M201780</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-23T11:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671781#M201781</link>
      <description>since "person_id from Dataset 1 can appear 1 or more times in Dataset 2" wouldn't it be more efficient to use 'inner join' instead "left join"?</description>
      <pubDate>Thu, 23 Jul 2020 11:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/671781#M201781</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-07-23T11:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/672028#M201891</link>
      <description>You may have a point there. I'll look into it. Thanks</description>
      <pubDate>Fri, 24 Jul 2020 06:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/672028#M201891</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-07-24T06:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent SAS from storing data in Work Folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/674149#M202949</link>
      <description>&lt;P&gt;Good Day everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the late reply, but we decided to go with an alternative approach. Instead of merging the 2 data sets, we are now filtering the second data set based on the national_id in the first data set. In this manner and for our purposes, we avoid the need for merging in the first place, thus being able to run a PROC SQL statement such as the below without issue:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table destfp.finalds_20200131 as
  select * from destfp.secondds_20200131
  where id_no in (select distinct person_id from dsfirst.firstds_202001);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yes, it is still a PROC SQL statement, however since we're not doing a join and the resultant data set is roughly a tenth of the size of the second data set, we are happy with the outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, due to the sensitivity of the data we are working with, I am not able to post sample data, however the code is a near-identical representation of the actual code we are running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone for the assistance. Special mention to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;for their ideas. Much appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 14:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Prevent-SAS-from-storing-data-in-Work-Folder/m-p/674149#M202949</guid>
      <dc:creator>SGcabashe1</dc:creator>
      <dc:date>2020-08-03T14:40:35Z</dc:date>
    </item>
  </channel>
</rss>

