BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Zaneta
Calcite | Level 5

Hi there,

I've recently discovered editable graphics in SAS - which are awesome!! Smiley Happy

I wondered though if it's possible to create an .SGE file from within SAS Enterprise Guide 4.3?  I currently have access to SAS 9.2 and SAS Enterprise Guide 4.3, and by using the following code in SAS 9.2 I can create an SGE file:

ODS listing GPATH = "C:\mygraphs" sge = on;

ods graphics on;

proc univariate data=duncan noprint;

   var income;

   histogram income;

run;

But when I run the same code in SAS Enterprise Guide 4.3, I just get a (non-editable) graph within SAS Enterprise Guide but no SGE file is created.  Except occasionally - sometimes when testing this code, in Enterprise Guide an extra tab opens saying that I need to download the results - this download button doesn't work (I get an error message saying that a problem has been encountered and EG needs to be closed) but the SGE file has been created, which is great!  But I can't detemine what I'm doing differently when this happens - can anyone help out?

An alternative solution to creating an editable graph from code that is run in SAS Enterprise Guide may be to use ODS Graphics Designer?  (I already have this set up to work from EG.)  Does anyone know if it's possible to create a graph in ODS Graphics Designer from code?  (as opposed to the usual method of creating code from point-and-click).

Many thanks in advance for any help Smiley Happy

Cheers,

Zaneta


1 ACCEPTED SOLUTION

Accepted Solutions
CaseySmith
SAS Employee

Hi Zaneta,


Even though EG doesn't know how to handle the SGE file, the SGE file should be created every time (in "C:\mygraphs" on the server, which sounds like the same machine in your case... Local server).  I submitted the same code using EG 4.3 and the SGE file (and PNG) is created every time for me.


You mentioned sometimes you see the SGE file get created and other times you don't.  One long-shot to check...  if you have code selected in the editor then hit F3 or F8, only the selected code will be submitted.  So, if you have the proc univariate block selected in the editor and then hit F3 or F8, you'll see the Results tab with the univariate graph, but the SGE file won't get created (and no additional Results tab corresponding with the SGE file).  Either make sure there is no selection in the editor when you hit F3/F8 or click the Run button to make sure you run all the code.


Another thing to note...  EG wraps the code in the editor with ODS statements corresponding to the results output formats you select in Tools->Options->Results->Results General (can also override by right-clicking a Program and selecting Properties->Results) and then closes all the ODS destinations (you can see in the Log), which is why your ODS LISTING statement with sge=on has to be submitted every time.  Could try turning EG's generated ODS wrapper code off (uncheck "Generate ODS Statements") to remove the chance it is interfering somehow.


Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

View solution in original post

6 REPLIES 6
Jay54
Meteorite | Level 14

The SGE file is created, but EG does not know about it and thus cannot download it to the PC.  For more details, you should post on the EG forum, and I will forward your question to the EG folks.   About Designer - The whole purpose of Designer is to create graphs using point and click.  If you want to create graphs using code, you have many options, including SAS/GRAPH procedures, new SG procedures and GTL.

Zaneta
Calcite | Level 5

Hi Sanjay,

Thanks very much for your comments, and for forwarding my question onto the EG group Smiley Happy  (apologies, I'm very new to the SAS forums and until now I didn't realise that there was one specifically for EG questions - excellent to know that there is one Smiley Happy ).

Re the SGE file being created - do you mean that indeed I should see this file in "C:\mygraphs" ?  This is the case when I run the code on SAS 9.2 but the file doesn't get created when I run the above code in SAS EG.  Do you know why this might be?

(it doesn't matter that SAS EG won't download the file as I can easily open the SGE file directly from the ODS Graphics editor anyway - but the problem is that I need the file to be created which currently isn't the case).

Thanks for your suggestions re ways of creating graphs using code too.  I've used several of these methods before and they work very well using code.  Do you know whether or not any of these methods can also be used in EG to create editable graphs?

Many thanks for your help Smiley Happy

Zaneta

CaseySmith
SAS Employee

Hi Zaneta,


Even though EG doesn't know how to handle the SGE file, the SGE file should be created every time (in "C:\mygraphs" on the server, which sounds like the same machine in your case... Local server).  I submitted the same code using EG 4.3 and the SGE file (and PNG) is created every time for me.


You mentioned sometimes you see the SGE file get created and other times you don't.  One long-shot to check...  if you have code selected in the editor then hit F3 or F8, only the selected code will be submitted.  So, if you have the proc univariate block selected in the editor and then hit F3 or F8, you'll see the Results tab with the univariate graph, but the SGE file won't get created (and no additional Results tab corresponding with the SGE file).  Either make sure there is no selection in the editor when you hit F3/F8 or click the Run button to make sure you run all the code.


Another thing to note...  EG wraps the code in the editor with ODS statements corresponding to the results output formats you select in Tools->Options->Results->Results General (can also override by right-clicking a Program and selecting Properties->Results) and then closes all the ODS destinations (you can see in the Log), which is why your ODS LISTING statement with sge=on has to be submitted every time.  Could try turning EG's generated ODS wrapper code off (uncheck "Generate ODS Statements") to remove the chance it is interfering somehow.


Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

MichelleHomes
Meteorite | Level 14

Hi Zaneta,

If you are running Enterprise Guide 4.3 and SAS 9.2 TS2M0 or later then it is seems it is possible.... check out this usage note: http://support.sas.com/kb/42/604.html

Check that you are running TS2M0 or later and then download and install the .dll as per the usage note.

I hope this helps.

Cheers,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
Zaneta
Calcite | Level 5

Hi everyone,

Thank-you very much for your help, much appreciated Smiley Happy

Casey - your information solved the problem for me - thanks so much!!!  The problem was that I hadn't realised that the EG closes all ODS destinations after each bit of code is submitted!!  So what was happening was that I was selecting and then submitting the ODS lines of code:

ODS listing GPATH = "C:\mygraphs" sge = on;

ods graphics on;

And after this I then selected and submitted the lines of code for the graph (I was doing a step at a time as I wanted to check where the problem lay) - but of course because I had already submitted the ODS lines of code in a separate step, immediately after EG opened the destinations it then closed them again!  Quite funny really!!

Running all of the code in a single step produces both the sge and png files each time - hooray!!! Smiley Happy

Michelle - thanks very much for your tip too.  I'd actually already installed the .dll to get ODS graphics designer working earlier and it worked beautifully Smiley Happy  But it's a great tip to know about as ODS graphics designer is brilliant for creating graphs from point-and-click!  For the particular thing that I was doing at the moment though, which is wanting to create a graph from code and then to edit this, I think that I need to use the ODS graphics editor rather than ODS graphics designer though, as I think that ODS graphics designer can only create a graph from point-and-click rather than from code?  But thank-you very much for your hint Smiley Happy

Also, on a related note, if anyone knows if one can create a graph in Designer from code, I'd be very interested in knowing about this (that'd be very handy if so - I prefer to use code as it's quicker in general than using point-and-click, however Designer is very handy for making changes to graphs as it saves one having to use the graph templating language!).  Or if anyone knows whether one can convert a SGE (ODS graphics editor) file to a SGD (ODS graphics designer) file, I'd also be most interested to know this (as then I could create the SGE file using code and then open the graph in Designer to make the changes).  (possibly I should create a new post re these questions?)

Many thanks to you all for your help Smiley Happy Smiley Happy Smiley Happy

Cheers,

Zaneta

Jay54
Meteorite | Level 14

Hi Zaneta,

Designer is a GUI versiion of GTL, and it generates GTL for you.  So, the way to create graphs using code is to use GTL or you can also create graphs using SG Procedures.  See many examples discussed in the blog Graphically Speaking.  You can also use SAS/GRAPH procedures like GCHART, GPLOT, etc. to create graphs.  There is no way to create graphs in Designer by typing code and it is not clear what is to be gained by doing this.  Smiley Happy

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1436 views
  • 6 likes
  • 4 in conversation