<?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 use ODS OUTPUT with PROC DATASETS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989280#M380184</link>
    <description>&lt;P&gt;The key thing is when the code EXECUTES.&amp;nbsp; Normally it executes a block of statements when it sees a RUN statement.&amp;nbsp; But some statements, like PROC SQL statements, execute immediately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try adding ODS TRACE OFF statement it various points and see when it stops listing the generated data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1 class2;
  set sashelp.class(obs=3);
run;
ods trace on;
proc datasets lib=work memtype=data;
ods trace off;
contents data=work.class1 ;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Personally I always code the ODS OUTPUT statement before the PROC statement.&amp;nbsp; That is just much clearer to me than mixing GLOBAL statements into the middle of step.&amp;nbsp; Just make sure that you have explicitly ended the preceding step.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2026 20:04:20 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-06-04T20:04:20Z</dc:date>
    <item>
      <title>How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989272#M380179</link>
      <description>&lt;P&gt;I am trying to put the outputput from PROC DATASETS into a sas datset. For example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods trace on;
proc datasets library=work memtype=catalog;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WeiChen_0-1780596439688.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/115686iD569F61747ECDE51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WeiChen_0-1780596439688.png" alt="WeiChen_0-1780596439688.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and in log i see&lt;/P&gt;
&lt;P&gt;Output Added:&lt;BR /&gt;-------------&lt;BR /&gt;Name: Members&lt;BR /&gt;Label: Library Members&lt;BR /&gt;Template: Base.Datasets.Members&lt;BR /&gt;Path: Datasets.Members&lt;BR /&gt;-------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when try us ODS OUTPUT (or SELECT), ODS thinks output not there:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets library=work memtype=catalog;
ods output Members= MyMembers;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;WARNING: Output 'Members' was not created. Make sure that the output object name, label, or path&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;is spelled correctly. Also, verify that the appropriate procedure options are used to&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;produce the requested output object. For example, verify that the NOPRINT option is not&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;used.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know some statements in PROC DATASETS have OUT= optins, like the CONTENTS stmt. but how can i get this table in a dataset? i dont see option to create output and ODS OUTPUT not working. Im on sas 9.4 latest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found other questionsm similar to mine:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Get-a-list-of-dataset-names-in-a-directory-library/m-p/476992" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Get-a-list-of-dataset-names-in-a-directory-library/m-p/476992&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Output-from-Proc-Datasets-as-a-data-file/m-p/489259#M72062" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Output-from-Proc-Datasets-as-a-data-file/m-p/489259#M72062&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 18:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989272#M380179</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2026-06-04T18:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989273#M380180</link>
      <description>&lt;P&gt;I'm surprised- it works if the ODS OUTPUT statement comes before the PROC, but not inside.&amp;nbsp; I typically like them before the PROC, but I don't think I've seen a case where they didn't work inside the PROC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    ods output Members= MyMembers;
2    proc datasets library=work memtype=catalog;
3    run;

NOTE: The data set WORK.MYMEMBERS has 2 observations and 5 variables.
4    quit;


5
6
7    proc datasets library=work memtype=catalog;
8    ods output Members= MyMembers;
9    run;

10   quit;

WARNING: Output 'Members' was not created.  Make sure that the output object name, label, or path is spelled correctly.  Also,
         verify that the appropriate procedure options are used to produce the requested output object.  For example, verify that
         the NOPRINT option is not used.
&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jun 2026 18:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989273#M380180</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-06-04T18:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989276#M380181</link>
      <description>&lt;P&gt;You need to execute the ODS OUTPUT statement before the statement that produces the output executes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC DATASETS is an "interactive" procedure, like PROC GLM or PROC SQL.&amp;nbsp; It can run many different commands before it exits, which is why you need a QUIT statement instead of a RUN statement to mark the end of the step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case the output is generated by the PROC statement itself, so the ODS OUTPUT statement must come before the PROC statement.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 19:09:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989276#M380181</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-04T19:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989277#M380182</link>
      <description>&lt;P&gt;In interactive procedures I thought the ODS statemtne had to come before the quit. See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; blog&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2011/12/12/sas-tip-put-ods-statements-inside-procedures.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2011/12/12/sas-tip-put-ods-statements-inside-procedures.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but quntin exampole shows proc datasets wierdly different.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 19:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989277#M380182</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2026-06-04T19:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989280#M380184</link>
      <description>&lt;P&gt;The key thing is when the code EXECUTES.&amp;nbsp; Normally it executes a block of statements when it sees a RUN statement.&amp;nbsp; But some statements, like PROC SQL statements, execute immediately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try adding ODS TRACE OFF statement it various points and see when it stops listing the generated data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1 class2;
  set sashelp.class(obs=3);
run;
ods trace on;
proc datasets lib=work memtype=data;
ods trace off;
contents data=work.class1 ;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Personally I always code the ODS OUTPUT statement before the PROC statement.&amp;nbsp; That is just much clearer to me than mixing GLOBAL statements into the middle of step.&amp;nbsp; Just make sure that you have explicitly ended the preceding step.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 20:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989280#M380184</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-04T20:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989281#M380185</link>
      <description>&lt;P&gt;I thought of Rick's blog when I read this as well.&amp;nbsp; Seems like the behavior of&amp;nbsp; PROC DATASETS supports the position of Otis Outside.&amp;nbsp;&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2013/04/08/pointcounterpoint-ods-select.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2013/04/08/pointcounterpoint-ods-select.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I agree with Tom's diagnosis.&amp;nbsp; It looks like the Members output object is being created by the PROC DATASETS statement itself.&amp;nbsp; If you add a CONTENTS statement, it will produce the Attributes object, and you can place the ODS statement to output that after the CONTENTS statement (but before the run).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    proc datasets library=work memtype=catalog;
2    contents;
3    ods output members=MyMembers Attributes=MyAttributes ;
4    run;

NOTE: The data set WORK.MYATTRIBUTES has 10 observations and 7 variables.
5    quit;

WARNING: Output 'members' was not created.  Make sure that the output object name, label, or path is spelled correctly.  Also,
         verify that the appropriate procedure options are used to produce the requested output object.  For example, verify that
         the NOPRINT option is not used.
&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jun 2026 20:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989281#M380185</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-06-04T20:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989283#M380187</link>
      <description>&lt;P&gt;I agree with Quentin and Tom. An ODS SELECT/OUTPUT statement must go before the statement that generates the table (or graph). In this case, it is the PROC DATASETS statement itself that creates the output. Run this example WITHOUT any RUN or QUIT statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class1 class2;
  set sashelp.class(obs=3);
run;
ods trace on;
proc datasets lib=work memtype=data;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even though there is no RUN or QUIT statement, you can see from the ODS trace statement that the output is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was not aware of this behavior. In my 2024 article about interactive procedures (&lt;A href="https://blogs.sas.com/content/iml/2024/10/09/interactive-procedures-sas.html" target="_blank"&gt;Interactive procedures in SAS - The DO Loop&lt;/A&gt;), I stated the following information from the PROC DATASETS documentation:&lt;BR /&gt;&lt;EM&gt;The interactive nature of PROC DATASETS is a different from other SAS procedures. The documentation states that it supports RUN-group processing, but "the DATASETS procedure supports four types of RUN groups.... &lt;STRONG&gt;Some statements in PROC DATASETS act as implied RUN statements&lt;/STRONG&gt; because they cause the RUN group preceding them to execute."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have boldfaced the statement that applies in this case. When I wrote the article, I don't think I fully appreciated what that boldfaced statement was telling us.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2026 21:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989283#M380187</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2026-06-04T21:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use ODS OUTPUT with PROC DATASETS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989297#M380189</link>
      <description>&lt;P&gt;thanks quentin, tom and rick!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I Am still very upset SAS remove interactive mode from sas studio and ODA. If you havent voted to ask sas to return thsi funtion please upvote at&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Product-Suggestions/Restore-Interactive-Perspective-in-SAS-Studio/idc-p/988630#M783" target="_blank"&gt;Restore Interactive Perspective in SAS Studio - SAS Support Communities&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2026 09:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-ODS-OUTPUT-with-PROC-DATASETS/m-p/989297#M380189</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2026-06-05T09:15:33Z</dc:date>
    </item>
  </channel>
</rss>

