<?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 DOCUMENT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990424#M84151</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285012"&gt;@SwissC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Not sure if you see the same but in my view of the page, the code box is not displaying correctly, I did honestly but each line of code on separate lines.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That happens when you edit the text inside the code block in the normal editor window instead of the code box pop-up window.&amp;nbsp; Put the cursor inside the code box and push the icon to get the pop-up to appear and then close the pop-up and the line breaks should be fixed.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jul 2026 13:24:01 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-07-02T13:24:01Z</dc:date>
    <item>
      <title>PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990399#M84146</link>
      <description>&lt;P&gt;Can anyone see what is going on with the PROC DOCUMENT below?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC DOCUMENT name=work.forreplay(write);

  /* Site 1 */
  MAKE site1;  
  /*  COPY \work.overview1\Print#1\Print#1 to site1;*/ 
SETLABEL site1 "Site: 1";

/* Group 1 */ 
MAKE site1\group1;
SETLABEL site1\group1 "Group 1"; 

MAKE site1\group1\past1_1; 
COPY \work.past1_1\Print#1\Print#1 to site1\group1\past1_1; 
SETLABEL site1\group1\past1_1 "Past"; 

MAKE site1\group1\pres1_1; 
COPY \work.pres1_1\Print#1\Print#1 to site1\group1\pres1_1; 
SETLABEL site1\group1\pres1_1 "Present"; 

MAKE site1\group1\fut1_1; 
COPY \work.fut1_1\Print#1\Print#1 to site1\group1\fut1_1; 
SETLABEL site1\group1\fut1_1 "Future"; 

/* Group 2 */ 
MAKE site1\group2; 
SETLABEL site1\group2 "Group 2"; 

MAKE site1\group2\past1_2; 
COPY \work.past1_2\Print#1\Print#1 to site1\group2\past1_2; 
SETLABEL site1\group2\past1_2 "Past"; 

MAKE site1\group2\pres1_2; 
COPY \work.pres1_2\Print#1\Print#1 to site1\group2\pres1_2; 
SETLABEL site1\group2\pres1_2 "Present"; 

MAKE site1\group2\fut1_2; 
COPY \work.fut1_2\Print#1\Print#1 to site1\group2\fut1_2; 
SETLABEL \site1\group2\fut1_2 "Future"; 

/* Site 2 */ 
MAKE site2; 
SETLABEL site2 "Site: 2"; 

/* Group 3 */ 
MAKE site2\group1; 
SETLABEL site2\group1 "Group 3"; 

MAKE site2\group1\past2_1; 
COPY \work.past2_1\Print#1\Print#1 to site2\group1\past2_1; 
SETLABEL site2\group1\past2_1 "Past"; 

MAKE site2\group1\pres2_1; 
COPY \work.pres2_1\Print#1\Print#1 to site2\group1\pres2_1; 
SETLABEL site2\group1\pres2_1 "Present"; 

MAKE site2\group1\fut2_1; 
COPY \work.fut2_1\Print#1\Print#1 to site2\group1\fut2_1; 
SETLABEL site2\group1\fut2_1 "Future"; 
RUN;
ODS document&amp;nbsp;close; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I created a bunch of outputs each into a separate ODS DOCUMENT, there will be lots of them in the end over lots of sites and groups (c.1000 in all).&lt;BR /&gt;But first I am testing with just a couple. As it stands it works as expect when I replay to PDF.&lt;/P&gt;
&lt;P&gt;The bookmarks are as I want them in a hierarchy.&lt;/P&gt;
&lt;P&gt;--&amp;gt;Site1&lt;/P&gt;
&lt;P&gt;----&amp;gt;Group1&lt;/P&gt;
&lt;P&gt;------&amp;gt;Past&lt;/P&gt;
&lt;P&gt;------&amp;gt;Present&lt;/P&gt;
&lt;P&gt;------&amp;gt;Future&lt;/P&gt;
&lt;P&gt;----&amp;gt;Group2&lt;/P&gt;
&lt;P&gt;------&amp;gt;Past&lt;/P&gt;
&lt;P&gt;------&amp;gt;Present&lt;/P&gt;
&lt;P&gt;--&amp;gt;Site2&lt;/P&gt;
&lt;P&gt;----&amp;gt;Group3&lt;/P&gt;
&lt;P&gt;------&amp;gt;Past&lt;/P&gt;
&lt;P&gt;------&amp;gt;Present&lt;/P&gt;
&lt;P&gt;------&amp;gt;Future&lt;/P&gt;
&lt;P&gt;------&amp;gt;Future&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;However when I uncomment the COPY under /*Site 1*/, I get an error&lt;BR /&gt;&amp;nbsp; ERROR: Invalid document path \Work.Forreplay\site1\group1&lt;BR /&gt;&lt;BR /&gt;Am I missing something here?&amp;nbsp; This copy is supposed to copy an overall Site report so is important.&lt;BR /&gt;&lt;BR /&gt;Note1: All outputs are created and available.&amp;nbsp; If I move the copy of issue to the end it runs fine, just puts that output at the end of the report where I do not want it.&lt;BR /&gt;Note2: This is a small sample, in the end I will create the PROC DOCUMENT code using some call execute statements to produce the 1000's of outputs needed. This has been tested with the same issues as above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;BR /&gt;SwissC&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 12:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990399#M84146</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2026-07-02T12:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990403#M84147</link>
      <description>Not sure if you see the same but in my view of the page, the code box is not displaying correctly, I did honestly but each line of code on separate lines.</description>
      <pubDate>Wed, 01 Jul 2026 19:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990403#M84147</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2026-07-01T19:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990423#M84150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285012"&gt;@SwissC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Not sure if you see the same but in my view of the page, the code box is not displaying correctly, I did honestly but each line of code on separate lines.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;I fixed the code block for you.&amp;nbsp; It's a weird bug in the message interface.&amp;nbsp; Not your fault.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 12:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990423#M84150</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-07-02T12:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990424#M84151</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285012"&gt;@SwissC&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Not sure if you see the same but in my view of the page, the code box is not displaying correctly, I did honestly but each line of code on separate lines.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That happens when you edit the text inside the code block in the normal editor window instead of the code box pop-up window.&amp;nbsp; Put the cursor inside the code box and push the icon to get the pop-up to appear and then close the pop-up and the line breaks should be fixed.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 13:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990424#M84151</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-07-02T13:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990425#M84152</link>
      <description>&lt;P&gt;I don't know PROC DOCUMENT well, but I've been playing with AI for SAS coding, so please take below suggestions with a large grain of salt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AI points to a small typo in your code.&amp;nbsp; This line has a leading backslash you don't want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SETLABEL \site1\group2\fut1_2 "Future";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but that's probably not the cause of the&amp;nbsp; problem.&amp;nbsp; AI also claims:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;That behavior is consistent with PROC DOCUMENT building the tree top-down and resolving paths as it goes. When&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;COPY \work.overview1\Print#1\Print#1 to site1;&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;runs at the top, SAS is touching&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;site1&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;before the rest of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;site1\group1&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;branch exists. If that copied object changes the current document context or occupies&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;site1&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as a node in a way SAS doesn’t expect, later&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;MAKE site1\group1;&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;can be seen as an invalid path. When you move the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;COPY&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the bottom, the full&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;site1&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;subtree already exists, so the copy lands in a valid destination and the error disappears.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The safe pattern here is: create all parent nodes first with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;MAKE&lt;/CODE&gt;, then do the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;COPY&lt;/CODE&gt;s, then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;SETLABEL&lt;/CODE&gt;s. If you want, I can rewrite the block into a clean order that avoids this class of PROC DOCUMENT path errors.&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And it then rewrote the code to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc document name=work.forreplay(write);

  /* Site 1 */
  make site1;
  setlabel site1 "Site: 1";

  /* Group 1 */
  make site1\group1;
  setlabel site1\group1 "Group 1";

  make site1\group1\past1_1;
  setlabel site1\group1\past1_1 "Past";

  make site1\group1\pres1_1;
  setlabel site1\group1\pres1_1 "Present";

  make site1\group1\fut1_1;
  setlabel site1\group1\fut1_1 "Future";

  /* Group 2 */
  make site1\group2;
  setlabel site1\group2 "Group 2";

  make site1\group2\past1_2;
  setlabel site1\group2\past1_2 "Past";

  make site1\group2\pres1_2;
  setlabel site1\group2\pres1_2 "Present";

  make site1\group2\fut1_2;
  setlabel site1\group2\fut1_2 "Future";

  /* Site 2 */
  make site2;
  setlabel site2 "Site: 2";

  /* Group 3 */
  make site2\group1;
  setlabel site2\group1 "Group 3";

  make site2\group1\past2_1;
  setlabel site2\group1\past2_1 "Past";

  make site2\group1\pres2_1;
  setlabel site2\group1\pres2_1 "Present";

  make site2\group1\fut2_1;
  setlabel site2\group1\fut2_1 "Future";

  /* Copy output objects after the tree exists */
  copy \work.overview1\Print#1\Print#1 to site1;
  copy \work.past1_1\Print#1\Print#1 to site1\group1\past1_1;
  copy \work.pres1_1\Print#1\Print#1 to site1\group1\pres1_1;
  copy \work.fut1_1\Print#1\Print#1 to site1\group1\fut1_1;

  copy \work.past1_2\Print#1\Print#1 to site1\group2\past1_2;
  copy \work.pres1_2\Print#1\Print#1 to site1\group2\pres1_2;
  copy \work.fut1_2\Print#1\Print#1 to site1\group2\fut1_2;

  copy \work.past2_1\Print#1\Print#1 to site2\group1\past2_1;
  copy \work.pres2_1\Print#1\Print#1 to site2\group1\pres2_1;
  copy \work.fut2_1\Print#1\Print#1 to site2\group1\fut2_1;

  run;

ods document close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It didn't actually run the code (because no test data to create the objects), so definitely could be wrong!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 13:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990425#M84152</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-07-02T13:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990428#M84153</link>
      <description>&lt;P&gt;I have found a/the solution, I will post it tomorrow when I have my works laptop open again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, I did try to put just the overview at the end but in the replayed document it was also at the end, may if I put all the copy statements at the end it would work, but I would need to call the the dataset I am using to drive the call executes twice.&lt;BR /&gt;&lt;BR /&gt;Out of interest, which AI did you use? The AI on Google search was terrible and kept giving me code that did not even run.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 16:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990428#M84153</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2026-07-02T16:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990431#M84154</link>
      <description>&lt;P&gt;Glad you found a solution.&amp;nbsp; Curious if you try the AI's code if it will work (even if not optimal for your call execute solution).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using GitHub Copilot in VS code with the SAS Extension.&amp;nbsp; GitHub Copilot automatically picks an LLM.&amp;nbsp; Looks like it used GPT-5.4 mini for my questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I have test data, it will actually write a program, then ask if it can batch submit it.&amp;nbsp; If I say yes, it will run the program, then check the log for errors, and iterate until it gets fixed.&amp;nbsp; Crazy stuff!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2026 16:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990431#M84154</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-07-02T16:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: PROC DOCUMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990461#M84155</link>
      <description>&lt;P&gt;To make this a little simpler,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of the three code samples below the first two worked fine, but when I tried to combine them in the third it threw an error that it could not find \site1\group1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC DOCUMENT name=work.a(write);
  /* Site 1 */
  MAKE site1;  
  SETLABEL site1 "Site: 1";

  /* Group 1 */ 
  MAKE site1\group1;
  SETLABEL site1\group1 "Group 1"; 

  MAKE site1\group1\past1_1; 
  COPY \work.past1_1\Print#1\Print#1 to site1\group1\past1_1; 
  SETLABEL site1\group1\past1_1 "Past"; 
RUN;
ODS document close; 

PROC DOCUMENT name=work.b(write);
  /* Site 1 */
  MAKE site1;  
  COPY \work.overview1\Print#1\Print#1 to site1;
  SETLABEL site1 "Site: 1";
RUN;
ODS document close; 

PROC DOCUMENT name=work.c(write);
  /* Site 1 */
  MAKE site1;  
  COPY \work.overview1\Print#1\Print#1 to site1;
  SETLABEL site1 "Site: 1";

  /* Group 1 */ 
  MAKE site1\group1;
  SETLABEL site1\group1 "Group 1"; 

  MAKE site1\group1\past1_1; 
  COPY \work.past1_1\Print#1\Print#1 to site1\group1\past1_1; 
  SETLABEL site1\group1\past1_1 "Past"; 
RUN;
ODS document close; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Eventually I managed to get Gemini (not the best idea for coding) to give me a working solution by using some DIR commands at the top level.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC DOCUMENT name=work.c(write);
  /* Site 1 */
  MAKE site1;  
  SETLABEL site1 "Site: 1";
  DIR site1;
  COPY \work.overview1\Print#1\Print#1 to ^;
  DIR ^^;

  /* Group 1 */ 
  MAKE site1\group1;
  SETLABEL site1\group1 "Group 1"; 

  MAKE site1\group1\past1_1; 
  COPY \work.past1_1\Print#1\Print#1 to site1\group1\past1_1; 
  SETLABEL site1\group1\past1_1 "Past"; 
RUN;
ODS document close; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Still not sure why exactly it did not work, I am assuming something to do with it being the top level.&amp;nbsp; Will try and investigate further when I get a chance with a different AI model.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2026 14:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-DOCUMENT/m-p/990461#M84155</guid>
      <dc:creator>SwissC</dc:creator>
      <dc:date>2026-07-03T14:15:57Z</dc:date>
    </item>
  </channel>
</rss>

