<?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: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904117#M43986</link>
    <description>&lt;P&gt;I am happy to be more specific. First off, I understand it can be difficult to get started not knowing the first step so I can help with that. A couple of questions, have you worked with C# or PowerShell? Even Python would probably be ok. But let's get a baseline on tech. Are you a programmer or an analyst? Have you worked with xpath by any chance?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help, take one of your egp files and just change the extension to zip and look at the contents.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can even write the code for you since I have a small amount of free time. If you have an egp file, save it where I can get it and tell me what change you want. I will code in C# but you can follow along. Once complete, I can place it in github for others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this in SAS as well. I will lay out a flow and someone else can handle the SAS code. Since I don't have access to SAS, I can't test so no need to try.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 17:37:29 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2023-11-21T17:37:29Z</dc:date>
    <item>
      <title>Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904112#M43985</link>
      <description>&lt;P&gt;This previous post explains my situation very well, but I don't feel it's been fully answered.&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-Replace-All-File-Path-Links-of-Program-in/td-p/719701" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Enterprise-Guide-Replace-All-File-Path-Links-of-Program-in/td-p/719701&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AlanC's reply mentions that there is a way to read in an .egp file through a zip library, manipulate the XML data within the file to change the file path references of the contained .sas programs, and then to re-zip and export the .egp file, but that is not nearly specific enough for me to follow. Can anyone describe this process in more detail and potentially provide a good template with reusability for the XML procedure part?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more background, I imagine this procedure (changing all file paths) may become a common procedure for me because of using different branches in GitLab to test out enhancements to existing code. I've copied the production .egp file that references the main branch/production .sas files and now I want to repoint the copy of the .egp to the new branch copies of the main branch/production .sas files that are stored in a separate folder to begin working on the enhancement. Basically I'm attempting not to disturb the production code/.egp files while setting myself up an area to mess with code.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 15:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904112#M43985</guid>
      <dc:creator>proc_talk</dc:creator>
      <dc:date>2023-11-21T15:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904117#M43986</link>
      <description>&lt;P&gt;I am happy to be more specific. First off, I understand it can be difficult to get started not knowing the first step so I can help with that. A couple of questions, have you worked with C# or PowerShell? Even Python would probably be ok. But let's get a baseline on tech. Are you a programmer or an analyst? Have you worked with xpath by any chance?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To help, take one of your egp files and just change the extension to zip and look at the contents.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can even write the code for you since I have a small amount of free time. If you have an egp file, save it where I can get it and tell me what change you want. I will code in C# but you can follow along. Once complete, I can place it in github for others.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this in SAS as well. I will lay out a flow and someone else can handle the SAS code. Since I don't have access to SAS, I can't test so no need to try.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 17:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904117#M43986</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-11-21T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904155#M43987</link>
      <description>&lt;P&gt;Oh great! Thank you, AlanC! Didn't expect to get you back immediately like that!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used Python before, but using it through my company device is more complicated than it really should be and would be inconvenient. That said, I don't have experience with the three other programming tools you mentioned (C#, PowerShell, xpath), however, I do have PowerShell on my machine so we could maybe go that route. The SAS-native flow would probably be the ideal solution. I'm used to programming in SAS/SQL and have done some VBA coding, but manipulating metadata like this is pretty uncharted territory for me. I mainly do ETL type of tasks and analysis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to change the extension of an .epg file to .zip and view the included XML file in Notepad. I see several lines in there that seem to be the ones of interest that look like this:&lt;/P&gt;&lt;PRE&gt;&amp;amp;lt;FullPath&amp;amp;gt;V:\directory1\subdirectory1\subdirectory2\subdirectory4\subdirectory5\my_program_name1.sas&amp;amp;lt;/FullPath&amp;amp;gt;&lt;/PRE&gt;&lt;P&gt;In my case, I'd like to basically swap [subdirectory5]'s value to a directory adjacent to the current one while maintaining the other directory names and program names. I'll need to do this for approximately 30 programs. Maybe just performing a manual find/replace and resaving the XML file and switching the extension back to .egp is a good enough solution for me honestly. I'll see if that works and report back.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, I'm not sure I can share the entire .epg file explicitly since it's a confidential work asset, but I can try to share as much as I can in a general sense as needed. Sorry for the extra layer of inconvenience there.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 22:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904155#M43987</guid>
      <dc:creator>proc_talk</dc:creator>
      <dc:date>2023-11-21T22:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904156#M43988</link>
      <description>&lt;P&gt;I never expected the whole file, just an example works which is what you have provided. SAS is not the best tool for this kind of work, IMO. You have C# and XPath on your machine as well since they are required for Windows to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me code up a C# program that does this, command line, and then you can modify to your heart's content in VS Code. Doing it manually is just a PITA and I can use a break from MS Office coding (VSTO).&amp;nbsp; &amp;nbsp;I have parts of it already so not a big deal.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 22:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904156#M43988</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-11-21T22:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904163#M43989</link>
      <description>&lt;P&gt;So hopefully you haven't gone too far down the rabbit hole on my behalf coding something up because this process does exactly what I need it to with minimal manual intervention:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Switch .egp extension to .zip&lt;/LI&gt;&lt;LI&gt;Examine the XML file in the .zip folder&lt;/LI&gt;&lt;LI&gt;Perform a find/replace on the current file path with the new file path&lt;/LI&gt;&lt;LI&gt;Save the XML file and .zip file&lt;/LI&gt;&lt;LI&gt;Switch the extension back to .egp&lt;/LI&gt;&lt;LI&gt;Verify that the file paths have updated after opening the .egp&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Thank you for the help! I thought it was going to be much more complicated than just a find/replace. They really should build that into EG as a feature!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 22:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904163#M43989</guid>
      <dc:creator>proc_talk</dc:creator>
      <dc:date>2023-11-21T22:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904171#M43990</link>
      <description>&lt;P&gt;I have not. Had to get stuff wrapped up for my client.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sounds like you have a plan. There may be open source software that does this already so search for that. Anything that can examine zip files should recognize it as a zip in the header. A number of companies use this technique including all Office products (ex. docx, xlsx, pptx, etc.). There are a number of commercial products, for Office, that handle their zips such as GemBox. My guess is there are general programs that can handle egp such as Directory Opus.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can script something up without too much trouble using PowerShell. Download PowerShell IDE (it may be on your machine). VS Code is also a useful editor for PowerShell. That can save you some time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Glad it worked out for you.&amp;nbsp; Ping me if you have any questions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 00:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904171#M43990</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-11-22T00:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Specific instructions to manipulate SAS Enterprise Guide XML file to bulk change .sas file paths</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904295#M44002</link>
      <description>&lt;P&gt;You could also investigate what the EG migration wizard could do for you - especially when used with a pre-generated mapping file.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/bicdc/9.4/bidaag/p0k4dj2wmcjv7tn1wvvardqja9iu.htm" target="_self"&gt;Migrate SAS Content with the Migration Wizard&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 22:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Specific-instructions-to-manipulate-SAS-Enterprise-Guide-XML/m-p/904295#M44002</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-11-22T22:28:54Z</dc:date>
    </item>
  </channel>
</rss>

