<?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: Optimizing CAS Storage space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962426#M375108</link>
    <description>&lt;P&gt;Use Proc CAS with the UPLOAD statement. It provides two advantages, you can specify to convert CHAR to VARCHAR and also specify the MEMORYFORMAT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc cas;
  action table.droptable / name="somedata" quiet=true;
run;
  upload / path="%sysfunc(pathname(work))/somedata.sas7bdat"
    casout={
      caslib="casuser"
      name="somedata"
      promote=true
      memoryformat="DVR"
    }
    importoptions={
      filetype="BASESAS"
      varcharConversion=17
    }
  ;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Mar 2025 21:11:34 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2025-03-21T21:11:34Z</dc:date>
    <item>
      <title>Optimizing CAS Storage space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962244#M375053</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;we have been working with Viya 4 for quite a while now and have started to get to a point where we need to be a bit more clever with how we use storage in CAS... what we think is going to be a real benefit to us is the concept of &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-Viya-CAS-Duplicate-Value-Reduction/ta-p/848324" target="_self"&gt;DVR&lt;/A&gt;&amp;nbsp;but we are struggling a bit with the syntax and wondered if someone out there might be able to help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the post linked above and another post about DVR it demonstrates the abilities of&amp;nbsp;memoryFormat="DVR" using the table.copytable actionset and indeed if we create a copy of an existing CAS dataset using this option we can see a massive table size reduction&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stewart_Jardine_0-1742396380153.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/105523i95E75426A271D3F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stewart_Jardine_0-1742396380153.png" alt="stewart_Jardine_0-1742396380153.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;as you can imagine this got us very excited and wanted to start using DVR on some of our bigger tables as soon as possible and this is where we started running in to syntax and potentially functional nightmares and tying ourselves in knots!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;firstly unless i am missing something fairly obvious you cannot load a standard SAS table, from a standard library such as WORK into CAS memory using "PROC CAS"... far as we have been able to tell you HAVE to use PROC CASUTIL - Please do correct me if i am wrong on this!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is where we enter the first loop of the knot... as far as we can tell you cannot set memoryformat using PROC CASUTIL ... so we have to load our table from work in to CAS using CASUTIL and the memoryformat is not set to DVR at this point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at this point, we understood from the documentation that there was 2 ways to set the memoryformat option either used the table.copytable actionset or table.loadtable actionset.... we decided we would save the file down as a sashdat while we were still in CASUTIL and then use table.loadtable in a PROC CAS step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc casutil incaslib=CARDS outcaslib=CARDS;
	droptable casdata="InLifeEclScenario2" quiet;
	load data=Group_InLifeEclScen_Final casout="InLifeEclScenario2";
	save casdata="InLifeEclScenario2" replace;
	droptable casdata="InLifeEclScenario2" quiet;
quit;

proc cas;
	table.loadTable / 
		caslib="CARDS", 
		path="InLifeEclScenario.sashdat", 
		casout={name="InLifeEclScenario2", caslib="CARDS", promote=TRUE memoryFormat="DVR" replication=0};
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this however results in a table exactly the same size as the original and the memory format doesn't seem to make a difference&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however if we test using the table.copytable actionset :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas; 
  table.copyTable /
    table={name="INLIFEECLSCENARIO" caslib="CARDS"}
    casOut={name="INLIFEECLSCENARIO_DVR" caslib="CARDS" memoryFormat="DVR" replace=True replication=0};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;we get the file size reduction we are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I'm left with is thinking that I need to use CASUTIL to load data and then create a copy of that data and then save it and then delete the original... this cant be right and I must be missing something... any experts out there who can help point out the piece of the puzzle I am missing I would be very grateful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2025 15:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962244#M375053</guid>
      <dc:creator>stewart_Jardine</dc:creator>
      <dc:date>2025-03-19T15:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing CAS Storage space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962251#M375057</link>
      <description>&lt;P&gt;this is the best that I have been able to come up with so far (but it feels clunky and not optimised)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc casutil incaslib=CARDS outcaslib=CARDS;
	load data=Group_InLifeEclScen_Final casout="InLifeEclScenario_temp";
quit;

proc cas; 
  table.copyTable /
    table={name="InLifeEclScenario_temp" caslib="CARDS"}
    casOut={name="INLIFEECLSCENARIO_DVR" caslib="CARDS" memoryFormat="DVR" replace=True replication=0};

	table.save / 
	table={name="INLIFEECLSCENARIO_DVR" caslib="CARDS"}, name="INLIFEECLSCENARIO_DVR.sashdat", caslib="CARDS",replace=TRUE;

	table.dropTable /           
	name="InLifeEclScenario_temp",	caslib="CARDS";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Mar 2025 15:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962251#M375057</guid>
      <dc:creator>stewart_Jardine</dc:creator>
      <dc:date>2025-03-19T15:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing CAS Storage space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962426#M375108</link>
      <description>&lt;P&gt;Use Proc CAS with the UPLOAD statement. It provides two advantages, you can specify to convert CHAR to VARCHAR and also specify the MEMORYFORMAT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc cas;
  action table.droptable / name="somedata" quiet=true;
run;
  upload / path="%sysfunc(pathname(work))/somedata.sas7bdat"
    casout={
      caslib="casuser"
      name="somedata"
      promote=true
      memoryformat="DVR"
    }
    importoptions={
      filetype="BASESAS"
      varcharConversion=17
    }
  ;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Mar 2025 21:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962426#M375108</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2025-03-21T21:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing CAS Storage space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962654#M375185</link>
      <description>&lt;P&gt;this seems like a great option thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 10:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Optimizing-CAS-Storage-space/m-p/962654#M375185</guid>
      <dc:creator>stewart_Jardine</dc:creator>
      <dc:date>2025-03-26T10:49:31Z</dc:date>
    </item>
  </channel>
</rss>

