Desktop productivity for business analysts and programmers

Create a SAS EG Project (7.1)

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Create a SAS EG Project (7.1)

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.

 


Accepted Solutions
Solution
‎12-05-2016 10:46 AM
Community Manager
Posts: 2,696

Re: Create a SAS EG Project (7.1)

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.

 

 

View solution in original post


All Replies
Esteemed Advisor
Posts: 6,661

Re: Create a SAS EG Project (7.1)

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 8

Re: Create a SAS EG Project (7.1)

@KurtBremser

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?

Community Manager
Posts: 2,696

Re: Create a SAS EG Project (7.1)

@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.

Esteemed Advisor
Posts: 6,661

Re: Create a SAS EG Project (7.1)

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎12-05-2016 10:46 AM
Community Manager
Posts: 2,696

Re: Create a SAS EG Project (7.1)

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.

 

 

Occasional Contributor
Posts: 8

Re: Create a SAS EG Project (7.1)

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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