BookmarkSubscribeRSS Feed
john83
Calcite | Level 5

Hi Folks,

How to view .cgm ext file. What tool do we need to view it.Following is the sample code.

filename fileref 'C:\whisker_mean.cgm';

goptions

   device = cgmof97l

   gsfname = fileref

   gsfmode = replace

   reset = symbol

   colors = (black)

   chartype = 6;

Thanks in advance,

John

13 REPLIES 13
robby_beum
Quartz | Level 8

SAS has a paper that talks about generateing output from CGM files located at http://support.sas.com/techsup/technote/ts674/ts674.html maybe you can gleen sometihng from there.

TS-674 - An Introduction to Exporting SAS/Graph Output to Microsoft Office SAS Release 8.2 and higher

john83
Calcite | Level 5

Thank you robby_beum , your reply helped me in finding the solution.

art297
Opal | Level 21

Did you try to open it with Internet Explorer?  If the extension is for Computer Graphics Metafile, IE, Paintshop or similar program will probably open it.

john83
Calcite | Level 5

Hi art297 ,

I tried opening the file using IE, Mozilla firefox  but was not successful.

Thanks for the reply,

John

art297
Opal | Level 21

Can you attach the file to your post?

john83
Calcite | Level 5

I am not able to attach the file. I have copy pasted some of the code.

If the following code is submitted , the cgm file will be saved in this location C:\whisker.cgm.

filenamefileref 'C:\whisker.cgm';

goptions

   device = cgmof97l

   gsfname = fileref

   gsfmode = replace

   reset = symbol

   colors = (black)

   chartype = 6;

The following sample first writes a CGM file to disk using the CGMOFML device driver.  The code then uses the GIMPORT procedure to import the CGM file back into SAS®

/* Assign a fileref for the graphics */
/* stream file that will be written  */
/* to disk.                          */
filename gsasfile 'c:\temp\sastest.cgm';

/* Turn off ODS styles */
options nogstyle; 

/* Use the CGMOFML device driver to write */
/* a CGM file to disk                     */
goptions reset=all device=CGMOFML
         border cback=white
         gsfname=gsasfile gsfmode=replace
         hsize=8 in vsize=6 in;

  /* Write the CGM graph to disk */
proc gslide;
run;
quit;

/* Reset the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt; 

/* Import the GSF file created by the CGM device driver */
proc gimport fileref=gsasfile
             filetype=cgm
             format=binary;
run;
quit;
source:
http://support.sas.com/kb/25/551.html

Bill
Quartz | Level 8

cgm files can be imported into powerpoint

you may need to make some changes to some of the powerpoint options to make them render correctly

john83
Calcite | Level 5

Hi Bill ,

Could you please tell me what changes I need to make , to open .cgm files

in MS Powerpoint.

Thanks in advance,

John

art297
Opal | Level 21

John,

With Powerpoint I am able to open a cgm file by creating a new page and inserting the file as a picture.

john83
Calcite | Level 5

art297,

Tried inserting .cgm file as a picture in Powerpoint but not successful. It showing an error "an error occured while importing this file".

Bill
Quartz | Level 8


John;

Someone else has already referred you to http://support.sas.com/techsup/technote/ts674/ts674.html#IIIB5a.  (It's a good paper that you should read through from beginning to end).  Although this references some older versions of PP, the problem may still exist in newer versions (I don't use cgm anymore.  Now that we have ods I run almost everything into pdf.  If I need something microsoft compliant, I use emf or png)  There are some additional cgm tips here http://support.sas.com/kb/4/027.html.  To get the full answer, you will likely need to surf through the microsoft website and look for KBs related to PP import filters.

art297
Opal | Level 21

John,

FWIW, I'm on Office2010 on an old thinkpad laptop running XP, and can import CGM files, flawlessly, using both PP and Word.

Obviously, I must be running something in the background, though, that you aren't.  Possibly .NET

john83
Calcite | Level 5

Hi Folks,

For time being I saving output with .jpeg format. Following is the sample code:

filenamefileref 'C:\whisker.jpeg';

goptions

   device = jpeg

   gsfname = fileref

   gsfmode = replace

   reset = symbol

   colors = (black)

   chartype = 6;

Thanks,

John

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
  • 13 replies
  • 17986 views
  • 3 likes
  • 4 in conversation