<?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: Remove intermediate files while retaining a specific one based on a pattern in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890231#M39592</link>
    <description>Thank you very much!</description>
    <pubDate>Mon, 21 Aug 2023 16:07:43 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2023-08-21T16:07:43Z</dc:date>
    <item>
      <title>Remove intermediate files while retaining a specific one based on a pattern</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890221#M39589</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to remove all intermediate files that are created while running a script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I would like to retain only a specific one, the most important whose name is the following: myres1_1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc datasets lib=work;&lt;BR /&gt;save myres1_1;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if I want to use a regex to specify the pattern "myres1*" instead of the full name? I have to concatenate many script so I cannot specify every time the name and hence the pattern will be useful.&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 15:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890221#M39589</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-08-21T15:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove intermediate files while retaining a specific one based on a pattern</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890223#M39590</link>
      <description>&lt;P&gt;Use colon `:`&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myres1_1 myres1_2 ABC def ghi;
set sashelp.class;
run;

proc datasets lib=work;
save myres1_:;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 15:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890223#M39590</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-08-21T15:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove intermediate files while retaining a specific one based on a pattern</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890225#M39591</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to save all the data sets with common beginning characters then the : list modifier may be of interest. This would save all the data sets whose names start with Pat_&amp;nbsp; .&lt;/P&gt;
&lt;PRE&gt;proc datasets library=work;
   save pat_:;
run;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use a list name range. You haven't provided much detail as to what may exist but if the other data sets have names with the same base but different sequence numbers, assuming your _1 is a "sequence" then something like this would save myres1_2, myres1_3 ... myres1_9. Caveat: all of the sequence numbers from 2 through 9 (or what ever you want) have to exist for the list to work. &lt;/P&gt;
&lt;PRE&gt;Proc datasets lib=work;
   save myres1_2 - myres1_9;
run;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to remove all intermediate files that are created while running a script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I would like to retain only a specific one, the most important whose name is the following: myres1_1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc datasets lib=work;&lt;BR /&gt;save myres1_1;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What if I want to use a regex to specify the pattern "myres1*" instead of the full name? I have to concatenate many script so I cannot specify every time the name and hence the pattern will be useful.&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 15:47:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890225#M39591</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-21T15:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Remove intermediate files while retaining a specific one based on a pattern</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890231#M39592</link>
      <description>Thank you very much!</description>
      <pubDate>Mon, 21 Aug 2023 16:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Remove-intermediate-files-while-retaining-a-specific-one-based/m-p/890231#M39592</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2023-08-21T16:07:43Z</dc:date>
    </item>
  </channel>
</rss>

