<?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: Cannot modify a dataset after using %SYSFUNC in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159804#M41652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still just guessing without seeing your code, but how about?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dsid=%sysfunc(open(labimp.muestra1,i));&lt;/P&gt;&lt;P&gt;%let nvar=%sysfunc(attrn(&amp;amp;dsid.,nvars));&lt;/P&gt;&lt;P&gt;%let rc=%sysfunc(close(&amp;amp;dsid.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s.&amp;nbsp; You'll probably have to start a new SAS session because, now, you have a number of opened files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Mar 2014 15:16:19 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2014-03-28T15:16:19Z</dc:date>
    <item>
      <title>Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159801#M41649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I keep getting this message after using %SYSFUNC:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;ERROR: You cannot open WORK.OUT_14.DATA for output access with member-level control because WORK.TEMP_DATA.DATA is in use by you&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;in resource environment DMS Process.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to make a macro variable to show how many columns in my SAS dataset. I used the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;%let nvar=%sysfunc(attrn(%sysfunc(open(work.temp_data,i)),nvars));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but after using this code, I cannot modify TEMP_DATA any more. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions? Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159801#M41649</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2014-03-28T14:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159802#M41650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think %sysfunc is your problem but, rather, that you have opened and not closed the file.&amp;nbsp; Try issuing the following (untested) right after the line where you get the number of variables.&amp;nbsp; Without seeing your code I'm not sure how you would have to call it:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff; background-color: #ffffff;"&gt;&lt;STRONG&gt;%let rc=%sysfunc(close(work.temp_data));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff; background-color: #ffffff;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159802#M41650</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-03-28T14:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159803#M41651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work. Getting the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Argument 1 to function CLOSE referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.&amp;nbsp; Execution of %SYSCALL statement or&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %SYSFUNC or %QSYSFUNC function reference is terminated.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;------------------EDITED----------------&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I also tried %sysfunc on my other datasets.&lt;/P&gt;&lt;P&gt;Getting the same error when I tried to modify the dataset again.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 15:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159803#M41651</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2014-03-28T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159804#M41652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still just guessing without seeing your code, but how about?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dsid=%sysfunc(open(labimp.muestra1,i));&lt;/P&gt;&lt;P&gt;%let nvar=%sysfunc(attrn(&amp;amp;dsid.,nvars));&lt;/P&gt;&lt;P&gt;%let rc=%sysfunc(close(&amp;amp;dsid.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s.&amp;nbsp; You'll probably have to start a new SAS session because, now, you have a number of opened files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 15:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159804#M41652</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-03-28T15:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159805#M41653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Arthur! Your code works.&lt;/P&gt;&lt;P&gt;It seems like that I have to use %sysfunc(close() ) to close the opened file. Am I correct? &lt;/P&gt;&lt;P&gt;I used the following code to do the test. If I did not apply the %sysfunc(close() ) line, I would still get the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp_data2; &lt;/P&gt;&lt;P&gt;input t1 t2 t3; datalines;&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dsid=%sysfunc(open(work.temp_data2,i));&lt;/P&gt;&lt;P&gt;%let nvar=%sysfunc(attrn(&amp;amp;dsid.,nvars));&lt;/P&gt;&lt;P&gt;%let rc=%sysfunc(close(&amp;amp;dsid.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;nvar;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 18:05:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159805#M41653</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2014-03-28T18:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot modify a dataset after using %SYSFUNC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159806#M41654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Close those open datasets!&lt;/P&gt;&lt;P&gt;Normally SAS just generates sequential fileid numbers so you can try running something like this to close any that might have open.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; do i=1 to 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rc=close(i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put i= rc=;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 18:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-modify-a-dataset-after-using-SYSFUNC/m-p/159806#M41654</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-03-28T18:36:21Z</dc:date>
    </item>
  </channel>
</rss>

