BookmarkSubscribeRSS Feed
Billybob73
Quartz | Level 8

Hi,

 

As you will know when unzipping an EGP file you get a project.xml file.

 

When I change this project.xml file in Windows explorer and then zip it again to an EGP file the EGP file opens perfectly in SAS.

 

However...........when I read project.xml file in SAS, do the same change in SAS, then write a dataset with the change as project.xml file to the network, rezip again to  EGP, SAS Enterprise Guide  won't open the file! (message : There was an error reading the project file , the format is invalid or not correct).

 

 

This is the code I use to read :

 

data programds1;
infile "g:\mylocation\project.xml" ;
length progtext $32000;
input;
progtext = _infile_;
run;

 

This is the code I use to write :

 

data _null_;
 file "g:\mylocation\project.xml";
 set work.programds1;
 put (progtext) (+(-1));
 run;

 

I'm using SAS EG 6.1 64bits.

 

Thanks !

B

5 REPLIES 5
Kurt_Bremser
Super User

Use an advanced editor (notepad++, hex mode) to check the difference(s) between the manually edited XML file and the one edited with SAS.

Once we know the change induced by SAS, we can search for ways around it.

ShenQicheng
Obsidian | Level 7

Try this,

data programds1;
	infile "g:\mylocation\project.xml" encoding="utf-16";
	length progtext $32000;
	input;
	progtext = _infile_;
run;

and 

data _null_;
	file "g:\mylocation\project.xml" encoding="utf-16";
	set work.programds1;
	put (progtext) (+(-1));
run;

Shen

Billybob73
Quartz | Level 8

Shen / Kurt,

 

This is it ! By default it encodes to ANSI. with this option to utf 16.

 

Why does this not work when I tried this ?

 

  filename zip pipe "zip  %superq(zipmap)\&zipfile %superq(zipmap)\*";

  data _null_;

    infile zip encoding="utf-16";

    input;

    put _infile_;

  run;

Billybob73
Quartz | Level 8

Another thing...although I was able to succesfully manipulate the project.xml file the results DO NOT show in the code that was in my EG.

 

In the EGP was a non-embedded program (one that was saved to a network location). I made a change to a libname path, but although it was changed in the project.xml file the results did not show in the programs within the EGP project.

 

Is there anything I forgot ?

 

Thanks

Rgds

B

ShenQicheng
Obsidian | Level 7

@Billybob73 wrote:

Shen / Kurt,

 

This is it ! By default it encodes to ANSI. with this option to utf 16.

 

Why does this not work when I tried this ?

 

  filename zip pipe "zip  %superq(zipmap)\&zipfile %superq(zipmap)\*";

  data _null_;

    infile zip encoding="utf-16";

    input;

    put _infile_;

  run;


What is the purpose of this code? The usage of the unnamed pipe is not correct, I think.

If you want to read files in a zip file within SAS code, you can try FILENAME ZIP access method

There are several blogs writen by Chris Hemedinger show how to use FILENAME ZIP access method.

Here are some URLs:

https://blogs.sas.com/content/sasdummy/2014/01/29/using-filename-zip/

https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in...

 

Hope this helps.

 

Shen

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1965 views
  • 0 likes
  • 3 in conversation