Desktop productivity for business analysts and programmers

extract code written in SAS EG 7.1

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

extract code written in SAS EG 7.1

I need to get to some code that I'd written in SAS EG 7.1 using EG 5.1

Is there a way to extract the code and run it in an earlier version of EG?

 


Accepted Solutions
Solution
‎09-06-2016 09:50 PM
PROC Star
Posts: 1,146

Re: extract code written in SAS EG 7.1

It's actually easy, but laborious.

 

An EG project is simply a .zip file. If you rename your xyz.egp to xyz.zip, you can browse it with anything that looks at .zip files. Among the included objects will be your code objects.

 

Tom

View solution in original post


All Replies
Solution
‎09-06-2016 09:50 PM
PROC Star
Posts: 1,146

Re: extract code written in SAS EG 7.1

It's actually easy, but laborious.

 

An EG project is simply a .zip file. If you rename your xyz.egp to xyz.zip, you can browse it with anything that looks at .zip files. Among the included objects will be your code objects.

 

Tom

Occasional Contributor
Posts: 6

Re: extract code written in SAS EG 7.1

Thanks, will give it a shot.

Occasional Contributor
Posts: 6

Re: extract code written in SAS EG 7.1

You're right, a bit laborious trying to figure out what the flies are as names are not the same. However, works like a charm! Thanks much!!

--Sonia

 

Super User
Posts: 3,240

Re: extract code written in SAS EG 7.1

An alternative to @TomKari's approach is to open the project in EG 7.1 and do a File - Export - Export All Code in Project.

Occasional Contributor
Posts: 6

Re: extract code written in SAS EG 7.1

Unfortunately don't have EG 7.1 installed (inadvertently reverted back to 5.1 when trying to restore older VM version). Downloading SAS 9.4, which comes with EG 7.1, in the VM takes forever :-( so was looking for an easy solution for a quick turnaround on a project.

Super User
Posts: 3,240

Re: extract code written in SAS EG 7.1

I guess its the @TomKari solution then...please confirm if this works for you.

Occasional Contributor
Posts: 6

Re: extract code written in SAS EG 7.1

Yup, @TomKari's solution worked well.
PROC Star
Posts: 1,146

Re: extract code written in SAS EG 7.1

Here's a piece of code I threw together a while ago...my apologies, but I don't have time to dive back into it and certify it. If you find it useful, I can tell my wife I wasn't wasting my time for once!

 

%let ProcessDir = C:\Users\directories;

%let DSN = DataSetName.egp;

%macro GetZipCode(ProcessDir, DSN, ZIPMember, SASMember);

filename inzip zip "&ProcessDir.\&DSN." member="&ZIPMember.";

data _null_;

infile inzip;

file "&ProcessDir.\&SASMember.";

input;

put _infile_;

run;

%mend; /* GetZipCode */

/* Assign a fileref wth the ZIP method */

filename inzip zip "&ProcessDir.\&DSN.";

 

/* Read the "members" (files) from the ZIP file */

data _null_;

length memname $200;

fid=dopen("inzip");

if fid=0 then

abort;

memcount=dnum(fid);

do i=1 to memcount;

memname=dread(fid,i);

if scan(memname, 2, "/") = "code.sas"

then call execute("%"||"GetZipCode(&ProcessDir., &DSN., "||trim(left(memname))||", "||trim(left(scan(memname, 1, "/")))||".sas);");

end;

rc=dclose(fid);

run;

Occasional Contributor
Posts: 6

Re: extract code written in SAS EG 7.1

Thanks! I'll definitely let you (your wife) know no time was wasted if this proves to work :-)
As with pending deadline of project, might not be able to dive into this for a little while.
cheers,
--Sonia
☑ This topic is solved.

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

Discussion stats
  • 9 replies
  • 695 views
  • 2 likes
  • 3 in conversation