BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
StoneCat
Fluorite | Level 6

Hello Community, 

 

I would like to have a SAS EG project created automatically with installed methods on the work computers.

With older SAS EG versions one could create a project.xml, which one afterwards with a ZIP program compressed. A subsequent renaming from .zip to .egp has worked great. However, no longer with the SAS EG 7.1 version. (The project is empty, or has to be updated or throws an error message). Did I use the wrong conversion from the file? Is there a global template?

 

Because of that, I've tried it with C Sharp (it works). However, the employees receive an error message when saving the document. In addition, I did not find a method to save the .sas file to an external location and point it to the SAS EG Project.

(https://communities.sas.com/t5/SAS-Enterprise-Guide/Failure-in-running-c-code-SAS-EG-7-1/m-p/313141#...)

 

Finally, I tried to find a solution here in the community. (https://communities.sas.com/t5/SAS-Communities-Library/Create-a-SAS-Project-Scaffold-on-the-Command-...)

Unfortunately this creates no .epg file, but only a single .sas file. In addition, I need a portable version of Python on our network, so that every employee can run my code.

 

Now I am with my knowledge at the end and now ask again actively, how to simplify the creation of SAS EG projects simplest? We manage everything about an Excel file with several macros, with which we had autoamtized all until 7.1.

The target solution is a SAS EG file with a .sas file which is also stored in a different location (save as).

 

Thank you very much.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Hi @StoneCat,

 

SAS doesn't document the EGP file format -- it is subject to change with each release.  So everything I'm sharing here is based on my ideas and experience, but does not represent an approach that would be officially supported.  You would want to conduct plenty of testing to ensure these processes worked for you.

 

That said, your method could be made to work, I think.  Approach:

  1. Create a template project file that is set up the way you want (one program node to references an external SAS file)
  2. Rename project EGP to ZIP
  3. Extract all contents to an "assets" directory.  This will have the project XML plus some other folders (project log, Git folders for program history) -- these are now standard parts of the project.
  4. In the Project XML, there will be a CodeTask element with the properties and path to the SAS file.  Change these to placeholder values that your process will replace each time when the user creates the new project.
  5. In your automated "project generation" process, replace these template values with the values you want the project to use.  You can use any tool that's good at reading/scanning/writing text files.  SAS programming can be used, or maybe your C# process.
  6. ZIP all of the content together, reassembling into a file with the EGP extension.

I've done this sort of thing with a SAS-based process, using SAS to read/modify the Project.XML file (as a text file, not as data), and then used ODS PACKAGE to assemble all files/folders into a ZIP file with an EGP extension.

 

To simplify, you could base your template on an earlier version of EG (before the Git integration, perhaps).  EG 7.1 can read/upconvert old projects.  Your users would be prompted with a message that the project file was from an earlier version.

 

 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

What is the purpose of this all?

If you want to supply pre-packaged projects, create them in a central location and have your software deployment tool copy them out to the clients.

StoneCat
Fluorite | Level 6

@Kurt_Bremser

Yes i want to supply pre-packaged projects. 

These should include a modified .sas program (replacing analysis path and other attributes).

The .sas program should also be stored externally (same folder as sas project). 

However, I have not yet found a suitable solution.

 

@ChrisHemedinger

Thanks for the guide. I will try again. 

Do you know what file conversion I need to read and write the xml file?  ISO-8859-1?

ChrisHemedinger
Community Manager

@StoneCat - don't try to read and write the XML as data -- treat is as a text-based template only.  If you use an XML parser and writer to process, the result won't be readable by EG.  You will need to use UTF-8 encoding for the text file.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Kurt_Bremser
Super User

If you need to modify certain parameters in programs, why not do it centrally?

Store a .sas with the necessary steps on your SAS server, and %include that in an autoexec code node in your prototype .egp.

That way that prototype egp does not need to be modified.

ChrisHemedinger
Community Manager

Hi @StoneCat,

 

SAS doesn't document the EGP file format -- it is subject to change with each release.  So everything I'm sharing here is based on my ideas and experience, but does not represent an approach that would be officially supported.  You would want to conduct plenty of testing to ensure these processes worked for you.

 

That said, your method could be made to work, I think.  Approach:

  1. Create a template project file that is set up the way you want (one program node to references an external SAS file)
  2. Rename project EGP to ZIP
  3. Extract all contents to an "assets" directory.  This will have the project XML plus some other folders (project log, Git folders for program history) -- these are now standard parts of the project.
  4. In the Project XML, there will be a CodeTask element with the properties and path to the SAS file.  Change these to placeholder values that your process will replace each time when the user creates the new project.
  5. In your automated "project generation" process, replace these template values with the values you want the project to use.  You can use any tool that's good at reading/scanning/writing text files.  SAS programming can be used, or maybe your C# process.
  6. ZIP all of the content together, reassembling into a file with the EGP extension.

I've done this sort of thing with a SAS-based process, using SAS to read/modify the Project.XML file (as a text file, not as data), and then used ODS PACKAGE to assemble all files/folders into a ZIP file with an EGP extension.

 

To simplify, you could base your template on an earlier version of EG (before the Git integration, perhaps).  EG 7.1 can read/upconvert old projects.  Your users would be prompted with a message that the project file was from an earlier version.

 

 

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
StoneCat
Fluorite | Level 6

I've always forgotten the default folder. Correspondingly, the program always went wrong on opening.

Furthermore does not have to be encoded in UTF-8, but in ucs-2, then everything works.

 

Thank you so much @ChrisHemedinger

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3416 views
  • 2 likes
  • 3 in conversation