<?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: how to reuse a table in the same session? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525528#M143008</link>
    <description>&lt;P&gt;It works by adding missing %. Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jan 2019 18:50:09 GMT</pubDate>
    <dc:creator>nnl3256</dc:creator>
    <dc:date>2019-01-08T18:50:09Z</dc:date>
    <item>
      <title>how to reuse a table in the same session?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525497#M142985</link>
      <description>There is data step and a table named fname is created. It is used in a macro. At end of the macro table is closed. When I rerun data step with modification in the same session, the table cannot be accessed. The error message: "ERROR: You cannot open WORK.FNAME.DATA for output access with member-level control because WORK.FNAME.DATA is in use by you in resource environment DMS Process." How can I re-use this table after the macro is completed? SAS code: data fname ; length id $2 name $10; input id $1-2 name $4-14; cards; aa TJC ;; run; %macro loopthrulst(list=); %let id=%sysfunc(open(&amp;amp;list)); %let NObs=%sysfunc(attrn(&amp;amp;id,NOBS)); %syscall set(id); %do i=1 %to &amp;amp;NObs; %let rc=%sysfunc(fetchobs(&amp;amp;id,&amp;amp;i)); %put # # # Display ORG name:&amp;amp;name # # #; %end; %let rc2=sysfunc(close(&amp;amp;id)); %mend; %loopthrulst(list=fname);</description>
      <pubDate>Tue, 08 Jan 2019 17:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525497#M142985</guid>
      <dc:creator>nnl3256</dc:creator>
      <dc:date>2019-01-08T17:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to reuse a table in the same session?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525502#M142993</link>
      <description>&lt;P&gt;The error message you show typically means that you have some sort of view of the data set open. Either the data portion in VIEWTABLE or perhaps the column or properties view. That will need to be closed before other use. The "DMS Process" mentioned is the SAS Display Manager or the "Base SAS" or "Foundation SAS" program. If the data set is open that will cause the Open function to fail and return the error message.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code will be more readable if you copy from the SAS editor and paste into a code box opened with either the {I} or "running man" icon.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 17:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525502#M142993</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-08T17:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to reuse a table in the same session?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525507#M142996</link>
      <description>&lt;P&gt;Formatting your code and question so we can properly read it is very helpful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're misisng the % on the last SYSFUNC call.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works for me, note I changed ID to DSID to avoid any confusion between the ID variable and the ID macro variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fname;
	length id $2 name $10;
	input id $1-2 name $4-14;
	cards;
 aa TJC 
;;
run;


options mprint symbolgen;
%macro loopthrulst(list=);

	%let dsid=%sysfunc(open(&amp;amp;list));
	%let nobs = %sysfunc(attrn(&amp;amp;dsid, NOBS));

	%syscall set(dsid);

	%do i=1 %to &amp;amp;nobs;
	  %let rc = %sysfunc(fetchobs(&amp;amp;dsid, &amp;amp;i));
	   %put # # # Display ORG name: &amp;amp;name # # #; 
    %end;
	%let rc2=%sysfunc(close(&amp;amp;dsid));


%mend;

%loopthrulst(list=fname);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173517"&gt;@nnl3256&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;There is data step and a table named fname is created. It is used in a macro. At end of the macro table is closed. When I rerun data step with modification in the same session, the table cannot be accessed. The error message: "ERROR: You cannot open WORK.FNAME.DATA for output access with member-level control because WORK.FNAME.DATA is in use by you in resource environment DMS Process." How can I re-use this table after the macro is completed? SAS code: data fname ; length id $2 name $10; input id $1-2 name $4-14; cards; aa TJC ;; run; %macro loopthrulst(list=); %let id=%sysfunc(open(&amp;amp;list)); %let NObs=%sysfunc(attrn(&amp;amp;id,NOBS)); %syscall set(id); %do i=1 %to &amp;amp;NObs; %let rc=%sysfunc(fetchobs(&amp;amp;id,&amp;amp;i)); %put # # # Display ORG name:&amp;amp;name # # #; %end; %let rc2=sysfunc(close(&amp;amp;id)); %mend; %loopthrulst(list=fname);&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 18:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525507#M142996</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-08T18:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to reuse a table in the same session?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525528#M143008</link>
      <description>&lt;P&gt;It works by adding missing %. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 18:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-reuse-a-table-in-the-same-session/m-p/525528#M143008</guid>
      <dc:creator>nnl3256</dc:creator>
      <dc:date>2019-01-08T18:50:09Z</dc:date>
    </item>
  </channel>
</rss>

