<?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: proc datasets: delete datasets, not formats in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554014#M74646</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/97807"&gt;@Mike_B&lt;/a&gt;&amp;nbsp;Here's a simple example that explains what is happening&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;See &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=p0dkrgts9nqrlen1wr90j2gfk9h9.htm&amp;amp;locale=en#p1arud59qlaom1n15ol8c9h2u5uj" target="_self"&gt;bullet #2 In Subordinate Statements:&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;after a slash (/) at the end of the statement. When used following a slash, the &lt;STRONG&gt;MEMTYPE= option refers to all SAS files named in the statement&lt;/STRONG&gt; unless the option appears in parentheses after the name of a SAS file. For example, the following statement deletes Lotpix.catalog, Regions.data, and Appl.catalog:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="xis-codeFragment"&gt;delete lotpix regions(memtype=data) appl / memtype=catalog;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i.e. MEMTYPE applies to the datasets you have listed in the SAVE statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example below, I create a formats catalog and a formats dataset, when the PROC DATASETS executes it will delete the formats catalog&amp;nbsp;as the MEMTYP=DATA tells it only to save the FORMATS dataset&lt;BR /&gt;&lt;BR /&gt;Hope this helps&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 format ;
	value
		$sex "M"="Male" "F"="Female" ;
run ;

data work.test1 ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

data work.test2 ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

data work.formats ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

proc datasets lib=work nolist ;	
	save test2  formats / memtype=data; /* memtype only applies to the list of datasets in the SAVe statement */
	                                    /* i.e. the formats dataset is not deleted but the formats catalog is */
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2019 16:18:33 GMT</pubDate>
    <dc:creator>AMSAS</dc:creator>
    <dc:date>2019-04-25T16:18:33Z</dc:date>
    <item>
      <title>proc datasets: delete datasets, not formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554007#M74645</link>
      <description>&lt;P&gt;I thought I understood how the memtype option in proc datasets worked, but I guess I was wrong. My program creates lots of temporary datasets as well as some formats and macros. I need to delete most--but not all--of the datasets after each iteration of a particular macro, but I need to save some sets and all formats and macros. I thought memtype=data would exclude macros and formats from deletion, but the formats are still getting deleted. What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
	save c final: template: / memtype=data; *these are all data sets;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 15:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554007#M74645</guid>
      <dc:creator>Mike_B</dc:creator>
      <dc:date>2019-04-25T15:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets: delete datasets, not formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554014#M74646</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/97807"&gt;@Mike_B&lt;/a&gt;&amp;nbsp;Here's a simple example that explains what is happening&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;See &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=p0dkrgts9nqrlen1wr90j2gfk9h9.htm&amp;amp;locale=en#p1arud59qlaom1n15ol8c9h2u5uj" target="_self"&gt;bullet #2 In Subordinate Statements:&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;after a slash (/) at the end of the statement. When used following a slash, the &lt;STRONG&gt;MEMTYPE= option refers to all SAS files named in the statement&lt;/STRONG&gt; unless the option appears in parentheses after the name of a SAS file. For example, the following statement deletes Lotpix.catalog, Regions.data, and Appl.catalog:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="xis-codeFragment"&gt;delete lotpix regions(memtype=data) appl / memtype=catalog;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i.e. MEMTYPE applies to the datasets you have listed in the SAVE statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example below, I create a formats catalog and a formats dataset, when the PROC DATASETS executes it will delete the formats catalog&amp;nbsp;as the MEMTYP=DATA tells it only to save the FORMATS dataset&lt;BR /&gt;&lt;BR /&gt;Hope this helps&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 format ;
	value
		$sex "M"="Male" "F"="Female" ;
run ;

data work.test1 ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

data work.test2 ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

data work.formats ;
	do i=1 to 5 ;
		output ;
	end ;
run ;

proc datasets lib=work nolist ;	
	save test2  formats / memtype=data; /* memtype only applies to the list of datasets in the SAVe statement */
	                                    /* i.e. the formats dataset is not deleted but the formats catalog is */
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 16:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554014#M74646</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2019-04-25T16:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets: delete datasets, not formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554017#M74647</link>
      <description>&lt;P&gt;Thank you. I modified (below), and it now saves the format catalog as well as the data files.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist memtype=(data catalog);
  save c final: template: formats;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Apr 2019 16:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-delete-datasets-not-formats/m-p/554017#M74647</guid>
      <dc:creator>Mike_B</dc:creator>
      <dc:date>2019-04-25T16:23:58Z</dc:date>
    </item>
  </channel>
</rss>

