Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS EG 4.1 path to code file

I'm using SAS Enterprise Guide 4.1 and my projects consist of a lot of code. That code is organized in external .sas files, mainly because .egp files are binary and plain text .sas files work better with git.

Problem is that SAS EG 4.1 uses apsolute paths to reference an external .sas file, so moving the project to different PC breaks the references to the code files (unless the other PC uses the same directory structure).

Is there any way to force SAS EG 4.1 to use relative paths (seems that SAS EG 4.3 uses relative paths, but upgrade is not an option). If not, is there at least a smart way to easily move projects?

For now, every time I have to move the project I embed the code into the project (which breaks revision control). Alternative is to delete all the references from the project and re-add them (which is a lot of work).

like image 385
Dejan Peretin Avatar asked Nov 06 '12 21:11

Dejan Peretin


People also ask

How do I find the path in SAS?

The idea is simple. Create a fileref pointing to the current working directory and then ask SAS what path that fileref points to. The path is then returned as the content of the macro.

How do I run code in SAS?

Submitting Code from the SAS NOTEPAD Text Editor SAS provides several ways to submit the code in NOTEPAD: Click the Submit toolbar button. Enter submit in the command bar. From the menu, select Run.


2 Answers

EGP files are just zip files, from my understanding. So you ought to have a couple of ways of solving this. The simplest to me seems to use git to version the files inside the zip file. So unzip the .egp file to a folder and version that folder. When you want to go back, zip the folder then change its name to .egp

There ought to be some way to modify the file that contains the paths in the .egp file after the fact, also, but I'm not sufficiently familiar with .egp files to be sure.

like image 157
Joe Avatar answered Oct 04 '22 03:10

Joe


So EGP files are just zip archives. Inside an archive there is a file named 'project.xml' which contains (sub)nodes like these:

<CodeTask>
  <IncludeWrapper>True</IncludeWrapper> 
  <Embedded>False</Embedded> 
  <LinkedOpenName>D:\some\path\to\program.sas</LinkedOpenName> 
</CodeTask>

This path seems to work only if it's apsolute. Relative path might work but I don't know relative to what to put it (relative to project path doesn't work).

But now I can write a simple script to go through this xml file after the project has been moved and update the paths (I keep .sas files in the same directory as .egp files, so this should not be a problem).

like image 20
Dejan Peretin Avatar answered Oct 04 '22 03:10

Dejan Peretin