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
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.
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
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;
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
@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/
Hope this helps.
Shen
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.