DATA Step, Macro, Functions and more

How to view .cgm extension file?

Reply
Contributor
Posts: 35

How to view .cgm extension file?

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

Contributor
Posts: 73

How to view .cgm extension file?

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

Contributor
Posts: 35

How to view .cgm extension file?

Posted in reply to robby_beum

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

PROC Star
Posts: 7,487

How to view .cgm extension file?

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.

Contributor
Posts: 35

How to view .cgm extension file?

Hi art297 ,

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

Thanks for the reply,

John

PROC Star
Posts: 7,487

How to view .cgm extension file?

Can you attach the file to your post?

Contributor
Posts: 35

Re: How to view .cgm extension file?

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

Super Contributor
Posts: 292

Re: How to view .cgm extension file?

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

Contributor
Posts: 35

Re: How to view .cgm extension file?

Hi Bill ,

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

in MS Powerpoint.

Thanks in advance,

John

PROC Star
Posts: 7,487

Re: How to view .cgm extension file?

John,

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

Contributor
Posts: 35

Re: How to view .cgm extension file?

art297,

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

Super Contributor
Posts: 292

Re: How to view .cgm extension file?


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.

PROC Star
Posts: 7,487

Re: How to view .cgm extension file?

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

Contributor
Posts: 35

Re: How to view .cgm extension file?

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

Ask a Question
Discussion stats
  • 13 replies
  • 14126 views
  • 3 likes
  • 4 in conversation