<?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: what is %sysfunc(open()) : a 0/1 answer or sth else in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923450#M363547</link>
    <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0q72zlfmfjplon1p3nprf85sdin.htm" target="_blank" rel="noopener"&gt;OPEN Function&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The OPEN function opens a SAS data set, DATA step, or a SAS SQL view and returns a &lt;STRONG&gt;unique numeric data set identifier&lt;/STRONG&gt;, which is used in most other data set access functions. OPEN returns 0 if the data set could not be opened.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Mon, 08 Apr 2024 17:32:14 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-04-08T17:32:14Z</dc:date>
    <item>
      <title>what is %sysfunc(open()) : a 0/1 answer or sth else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923449#M363546</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question on %sysfunc(open())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought&amp;nbsp; &lt;STRONG&gt;%sysfunc(open())&lt;/STRONG&gt; is open a dataset, which give 0 or 1 to show whether the dataset is opened successfully.&amp;nbsp; I accidentally forgot to close the file, and found that if I keep running following code, &amp;amp;_dsid is not a 0,1&amp;nbsp; value, instead it will keep going up to 2, 3, 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone explain what&amp;nbsp; _dsid really is?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and also what varnum(1,&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;amp;_colvar)&amp;nbsp;is.&amp;nbsp;why&amp;nbsp;1 instead of not&amp;nbsp;a&amp;nbsp;dataset&amp;nbsp;name&amp;nbsp;here?&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let _dsid=%sysfunc(open(sashelp.baseball));
%put &amp;amp;_dsid;
%let _colvar=team;
%let _varnum=%sysfunc(varnum(&amp;amp;_dsid,&amp;amp;_colvar));
%put &amp;amp;_varnum;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 17:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923449#M363546</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-04-08T17:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: what is %sysfunc(open()) : a 0/1 answer or sth else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923450#M363547</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n0q72zlfmfjplon1p3nprf85sdin.htm" target="_blank" rel="noopener"&gt;OPEN Function&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The OPEN function opens a SAS data set, DATA step, or a SAS SQL view and returns a &lt;STRONG&gt;unique numeric data set identifier&lt;/STRONG&gt;, which is used in most other data set access functions. OPEN returns 0 if the data set could not be opened.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 08 Apr 2024 17:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923450#M363547</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-04-08T17:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: what is %sysfunc(open()) : a 0/1 answer or sth else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923451#M363548</link>
      <description>&lt;P&gt;If you want to know what %SYSFUNC(OPEN()) returns then ignore the use of the %SYSFUNC() wrapper macro function and just look at the documentation of the&lt;A href="https://documentation.sas.com/doc/en/sclref/9.4/n156zfpuurn06un1is86musptulx.htm" target="_self"&gt; actual OPEN() function&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It does NOT return a boolean 0/1 answer.&amp;nbsp; Instead it returns the File handle (or in this case what the documentation calls a table-id) that is required to be used by the other functions that can operate on an open dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the OPEN() fails then it returns 0 instead of an actual number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the OPEN() succeeds then you need to make sure to call CLOSE(), passing the in the file handle OPEN() generated, so you close it.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 17:34:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923451#M363548</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-04-08T17:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: what is %sysfunc(open()) : a 0/1 answer or sth else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923452#M363549</link>
      <description>&lt;P&gt;Also see&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/n1bai32d7gp3yen1dq2fvfbizx0s.htm" target="_blank" rel="noopener"&gt;VARNUM Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 17:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-is-sysfunc-open-a-0-1-answer-or-sth-else/m-p/923452#M363549</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-04-08T17:35:03Z</dc:date>
    </item>
  </channel>
</rss>

