Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adjusting the project.xml file in a SAS Enterprise Guide project outside SAS EG

We are going to migrate our EG projects (over 1000 projects) to a new environment. In the old environment we use "W-Latin" as encoding on the Teradata database. In the new environment we will start using "UTF-8" as encoding on the Teradata database.
And a lot of other changes which I believe are not relevant for this question.

To prevent data issues we will have to replace functions like REVERSE, etc with KREVERSE, etc We could do this by opening al projects and clicking through it to change the functions in the expression builder.

This would be really time consuming, considering that we have over 1000 .egp files

We already have a code scanner that unzips the .egp file and detects al the use of these functions in the project.xml file.

The next step could be that we find and replace the functions and put the project.xml file back in the .egp file.

Who can tell me how to put the project.xml file back in the .egp file without corrupting the .egp file

like image 731
Aniel Avatar asked Oct 17 '22 14:10

Aniel


1 Answers

I was able to do this.

tl;dr -- Zip the files back up and change the extension to .egp.

Created a new EG project and added a code node to create sample data:

data test;
do cat = "A", "B", "C";
    do i=1 to 10;
        r = rannor(123);
        output;
    end;
end;
drop i;
run;

I then added a Query node to the output to do a "SUM" of the r column by cat.

Ran the flow and got expected output.

Saved the EG project.

Opened the EG Project in 7zip and extracted the archive to a location.

In project.xml, I found the section for the Query and changed the SUM to MEAN

                        <Expression>
                            <LHS_TYPE>LHS_FUNCTION</LHS_TYPE>
                            <LHS_DMCOLGROUP>Numeric</LHS_DMCOLGROUP>
                            <RHS_TYPE>RHS_COLUMN</RHS_TYPE>
                            <RHS_DMCOLGROUP>Numeric</RHS_DMCOLGROUP>
                            <InFormat />
                            <LHS_String>MEAN</LHS_String>
                            <LHS_Calc />
                            <OutputType>OPTYPE_NOTSET</OutputType>
                            <RHS_StringOne>r</RHS_StringOne>
                            <RHS_StringTwo />
                        </Expression>

Selected the files and added them to an achieve using 7zip. Selected "zip" compression and saved the file with ".egp" extension.

I opened the project in EG and ran the flow. The output was now the MEAN of R and not the SUM.

like image 198
DomPazz Avatar answered Oct 21 '22 03:10

DomPazz