DATA Step, Macro, Functions and more

change project.XML from SAS EG within SAS

Reply
Contributor
Posts: 55

change project.XML from SAS EG within SAS

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

Super User
Posts: 9,873

Re: change project.XML from SAS EG within SAS

Posted in reply to Billybob73

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 37

Re: change project.XML from SAS EG within SAS

Posted in reply to Billybob73

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

Contributor
Posts: 55

Re: change project.XML from SAS EG within SAS

Posted in reply to qicheng_shen_diva_co_jp

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;

Contributor
Posts: 55

Re: change project.XML from SAS EG within SAS

Posted in reply to Billybob73

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

Contributor
Posts: 37

Re: change project.XML from SAS EG within SAS

Posted in reply to Billybob73

@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

Ask a Question
Discussion stats
  • 5 replies
  • 99 views
  • 0 likes
  • 3 in conversation