<?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: proc datasets; + Title statement in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490448#M72105</link>
    <description>&lt;P&gt;Not 100% sure ... title-statement in proc datasets is executed after proc datasets started writing output. When you execute the 4th step again the title-statement from the last call is still active and thus the expected title is displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 13:23:33 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2018-08-28T13:23:33Z</dc:date>
    <item>
      <title>proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490445#M72104</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Question regarding adding a simple title to PROC DATASETS;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I'm on Base 9.4.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;4 simple steps to get to my question below.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;1)&amp;nbsp;clear out all&amp;nbsp;previous results and titles for a 'clean slate' &lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3"&gt;&lt;CODE class=" language-sas"&gt;/* clear out results */
dm 'odsresults;clear';
/* Using TITLE without arguments cancels all existing titles*/
title;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;2)&amp;nbsp;'print' the title to verify it is cleared&amp;nbsp;/*log: No observations in data set SASHELP.VTITLE.*/&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;CODE class=" language-sas"&gt;/&lt;FONT size="3"&gt;* print the current title*/
proc print data=Sashelp.VTitle; run;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Arial"&gt;3)&amp;nbsp;add a new title and print to verify&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT size="3"&gt;&lt;CODE class=" language-sas"&gt;/* add a new title*/
title 'reset';
/* print the current title*/
proc print data=Sashelp.VTitle; run;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT size="3"&gt;4) run a simple PROC DATASETS on the default library WORK and add a title statement&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fyi: there are data sets in WORK)&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;CODE class=" language-sas"&gt;proc datasets;
title 'proc datasets - Work';
quit;&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;OBSERVATION:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;The first time I run steps 1-4 above:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;The title&amp;nbsp;showing&amp;nbsp;on top of the 'Directory Info. + Library Members' output is "&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;reset" (&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;the 'old' title)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;However: The second time I run just step 4):&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;The title shows &lt;FONT face="Arial"&gt;"proc datasets - Work"&lt;/FONT&gt; as I would have expected the first time around&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;QUESTION:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;The TITLE statement does not need a run; correct ?&amp;nbsp;... I tried it with a run; + quit; and no difference.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I do understand that&amp;nbsp;PROC DATASETS only needs quit; (unless one wants to add run; as part of run groups)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;So ... what might be the issue that prevents TITLE from being 'recognized the first time around' within the PROC DATASETS procedure + TITLE statement&amp;nbsp;?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;greatly appreciate any insight&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 13:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490445#M72104</guid>
      <dc:creator>Rampsas1</dc:creator>
      <dc:date>2018-08-28T13:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490448#M72105</link>
      <description>&lt;P&gt;Not 100% sure ... title-statement in proc datasets is executed after proc datasets started writing output. When you execute the 4th step again the title-statement from the last call is still active and thus the expected title is displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 13:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490448#M72105</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-08-28T13:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490457#M72106</link>
      <description>&lt;P&gt;About your observation that "&lt;SPAN&gt;The TITLE statement does not need a run; correct ?&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While that is correct, there may be problems with step boundaries (to which the previous reply alluded).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is best to always use a RUN; statement following a TITLE statement to insure that the TITLE statement actually executes where you think it will execute.&amp;nbsp; This&amp;nbsp;is especially important when -- as you do here -- you are using "TITLE ; " to clear all previous titles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While this may not be the exact issue you have here (i.e., step boundary control), it is a good habit to have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 13:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490457#M72106</guid>
      <dc:creator>DocSteve</dc:creator>
      <dc:date>2018-08-28T13:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490467#M72107</link>
      <description>&lt;P&gt;Put title statements outside the procedure.&amp;nbsp; There is no proc datasets option for title, so it should not be there.&amp;nbsp; Always separate out bits unless absolutely needed, e.g:&lt;/P&gt;
&lt;PRE&gt;title 'proc datasets - Work'; 

proc datasets; 
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490467#M72107</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-28T14:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490486#M72111</link>
      <description>&lt;P&gt;If your code is as shown I suspect it's a timing issue. The title statement is after your PROC DATASETS so it's not available when the PROC starts, but is available for the next run. To clear all title statements you use your step #1 method and place your title ahead of your PROC. A lot of the demo code shows in it various places, but in general, I find before the proc is the best place to not have issues like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more control over when it's outputted, PROC ODSTEXT allows some of that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 14:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490486#M72111</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-28T14:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490558#M72120</link>
      <description>&lt;P&gt;Many thanks for all the replies. Very helpful.&amp;nbsp; Especially the observations about&amp;nbsp;"There is no proc datasets option for title" and "step boundaries" (a good general practice)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course ...&amp;nbsp;I now see said the blind man.&lt;/P&gt;&lt;P&gt;I have summarized the responses into a 'pseud-method' as follows (to include PROC CONTENTS and a subordinate CONTENTS statement within PROC DATASETS) .&lt;/P&gt;&lt;P&gt;I realize this is fairly&amp;nbsp;basic here but I like the KISS approach when things go astray in my understanding.&lt;/P&gt;&lt;P&gt;I'm always open to further insight from the experts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;1) Clean the slate&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* clear out results */
dm 'odsresults;clear';
/* Using TITLE without arguments cancels all existing titles*/
title;
/* "print" the current title to confirm cleared */
proc print data=Sashelp.VTitle; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;Within PROC DATASETS, there is apparently no TITLE 'option' or TITLE 'statement'&lt;/P&gt;&lt;P&gt;Therefore, we need apply the TITLE **global statement** outside of PROC DATASETS&lt;/P&gt;&lt;P&gt;** When we run a simple PROC DATASETS, the previously defined TITLE global statement is applied to the output 'automatically'&lt;/P&gt;&lt;P&gt;**&amp;nbsp;This I did not know .. and was the crux of the issue I was observing.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; (Output is: Directory Information + Library Members)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'proc datasets - Work Library '; 
run;
proc datasets;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;3)&lt;/P&gt;&lt;P&gt;Within PROC CONTENTS, use of a subordinate TITLE statement IS apparently OK&lt;/P&gt;&lt;P&gt;When we run a simple PROC CONTENTS, the TITLE statement (as defined within the procedure) is applied to the output&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; (Output is: Attributes + Engine/Host Dependent Information + Alphabetic List of Variables and Attributes)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;proc contents data=work.data_test_1;
title 'proc contents - Work.data_test_1 Data Set '; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;4) We can then combine the PROC DATASETS procedure with a CONTENTS subordinate statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (not that we necessarily want or need&amp;nbsp;to see&amp;nbsp;'Library&amp;nbsp;Level contents' via PROC DATASETS at the same time as 'Data Set Level'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contents via a CONTENTS statement but a good exercise for clarity .. so says I)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'proc datasets - Work Library'; 
run;
proc datasets lib=WORK memtype=data;
contents data=WORK.DATA_TEST_1;
title 'contents - Work.DATA_TEST_1 Data Set';
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 17:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490558#M72120</guid>
      <dc:creator>Rampsas1</dc:creator>
      <dc:date>2018-08-28T17:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490750#M72132</link>
      <description>&lt;P&gt;Several things.&lt;/P&gt;
&lt;P&gt;First, mark the person who answered your question as Correct, not your own response.&lt;/P&gt;
&lt;P&gt;Second, step 1 does not do anything, bin it.&lt;/P&gt;
&lt;P&gt;Third, do not put a run; after each title, that makes no sense.&amp;nbsp; Run is there to finish procedures or datastep, title statement is not a procedure or datastep.&lt;/P&gt;
&lt;P&gt;Step 4 seems a bit over the top, if you want a contents printed then:&lt;/P&gt;
&lt;PRE&gt;title "abc";

proc contents data=work.data_test_1;
run;&lt;/PRE&gt;
&lt;P&gt;I.e. use the procedure for the task (and avoid coding in upper case).&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 07:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/490750#M72132</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-29T07:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: proc datasets; + Title statement</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/491661#M72189</link>
      <description>&lt;P&gt;Here is an example of using the TITLE Statement in Proc DATASETS, changing the title with each iteration within the single proc.&amp;nbsp; The RUN; Statement following each title insures that the execution is tied to the statement before it, not after it, thus removing some ambiguity.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc datasets library=sashelp nolist ;&lt;BR /&gt;&amp;nbsp; contents data=burrows short ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; title burrows ;&lt;BR /&gt;&amp;nbsp; run ;&lt;BR /&gt;&amp;nbsp; contents data=cars short ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; title cars ;&lt;BR /&gt;&amp;nbsp; run ;&lt;BR /&gt;quit ;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 15:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-datasets-Title-statement/m-p/491661#M72189</guid>
      <dc:creator>DocSteve</dc:creator>
      <dc:date>2018-08-31T15:11:44Z</dc:date>
    </item>
  </channel>
</rss>

