The following examples illustrate major features of the GIMPORT procedure. For illustration purposes, these examples create a CGM using SAS/GRAPH software and import the resulting CGM by using the GIMPORT procedure. Ordinarily, you would use the GIMPORT procedure to import graphics output that is generated by another software package.
Note: Because this example uses a CGM device driver to produce a graphics stream file, you may need to respecify a device driver for your output device. In addition, these examples use the HSIZE= and VSIZE= graphics options to set a specific size for the graphics output area for the CGM so that the second example can illustrate the use of the SCALE and TRANSLATE statements. Depending on the output device that you are using, you may need to adjust the HSIZE= and VSIZE= values in this example and the values in the SCALE and TRANSLATE statements in the second example.
Procedure features:
GIMPORT statement options:
FILEREF=
FILETYPE=
FORMAT=
Other features:
FILENAME statement
GOPTIONS stratement
Sample library member: GIPCRCGM
This example creates a CGM in binary format by directing SAS/GRAPH output to a graphics stream file (GSF) and using a CGM device driver. It uses the GIMPORT procedure to import the resulting CGM into SAS/GRAPH where it can be viewed and stored in a catalog. (See Chapter 2, SAS/GRAPH Programs, on page 25 for additional information on catalog entries and graphics stream files.) The output shows the imported version of the graphic. Note that the output uses the default font because the specified fonts are unavailable. Example 2 on page 979 shows how to map these fonts to get the output that you want. Also see About Font Mapping on page 972 for additional information.
Assign the fileref for a graphics stream file and set the graphics environment. Set graphics stream file characteristics, and select the CGM device driver for binary CGM.
filename gsasfile ' external-file '; goptions reset=global gunit=pct border cback=white colors=(black) gaccess=gsasfile gsfmode=replace noprompt device=cgm hsize=5 in vsize=5 in vpos=60 hpos=150;
Define titles and footnote for slide.
title1 f=script h=7 'Title One is SCRIPT Font'; title2 f=centb h=5 'Title Two is CENTB Font'; title3 f=zapf h=5 'Title Three is ZAPF Font'; footnote h=3 f=swiss j=r 'GIPCRCGM ';
Generate a slide. The graphics output is stored in the GSF file that was specified with the fileref and in the GOPTIONS statement.
proc gslide; run; quit;
Reset the graphics environment.
goptions reset=goptions border cback=white colors=(black);
Import the GSF file created by the CGM device driver. FILEREF= specifies the fileref where the CGM is located. FILETYPE= specifies the type of file to be imported. FORMAT= specifies the format of the CGM being imported.
proc gimport fileref=gsasfile filetype=cgm format=binary; run;
Output 33.1 shows the font list that is displayed in the log file. The font list contains all of the fonts that are used by the CGM. The warning messages following the font list indicate which fonts can be remapped using the MAP statement.
. . . NOTE: These fonts are used in this CGM file. You may use the MAP statement to map these fonts to SAS/GRAPH fonts. 1. SIMPLEX 2. BRUSH 3. CENTB 4. CENTBE 5. CENTBI 6. CENTBIE 7. CENTX 8. CENTXE 9. CENTXI 10. CENTXIE 11. GERMAN 12. GITALIC 13. DUPLEX 14. COMPLEX 15. TRIPLEX 16. TITALIC 17. ITALIC 18. OLDENG 19. SCRIPT 20. CSCRIPT 21. SWISS 22. SWISSE 23. SWISSB 24. SWISSBE 25. SWISSBI 26. SWISSBIE 27. SWISSX 28. SWISSXE 29. SWISSXB 30. SWISSXB 31. SWISSXBE 32. SWISSI 33. SWISSIE 34. SWISSL 35. SWISSLE 36. ZAPF 37. ZAPFE 38. ZAPFB 39. ZAPFBE 40. ZAPFBI 41. ZAPFBIE 42. ZAPFI 43. ZAPFIE WARNING: Unspecified font index 19. Font has been mapped to the default font. WARNING: Unspecified font index 3. Font has been mapped to the default font. WARNING: Unspecified font index 36. Font has been mapped to the default font. WARNING: Unspecified font index 21. Font has been mapped to the default font. . . .
Procedure features:
SCALE statement
TRANSLATE statement
MAP statement
Sample library member: GIPGROUT
This example imports the CGM file that was created in the earlier example and modifies the output. This example uses the SCALE and TRANSLATE statements to correct the size and position of the imported CGM. The MAP statement is also used to substitute a SAS/GRAPH software font for a font in the CGM.
Assign the fileref for a GSF file and set the graphics environment.
filename gsasfile ' external-file '; goptions reset=goptions gunit=pct border cback=white colors=(black) htitle=6 htext=3 vpos=60 hpos=150;
Import the GSF file created by the CGM device driver. The SCALE statement specifies the scale factor for the values of the x and y coordinates. The TRANSLATE statement specifies the amount that the imported graphics output should be moved horizontally and vertically. The MAP statements remap the fonts shown in the first example.
proc gimport fileref=gsasfile filetype=cgm format=binary; scale x=.7 y=.8; translate x=3.5 y=10; map 'SCRIPT' to script; map 'CENTB' to centb; map 'ZAPF' to zapf; map 'SWISS' to swiss; run;
Output 33.2 shows the font list that is displayed in the log file. Note that no warning messages follow the font list because all of the fonts that are used in the CGM have been remapped.
. . . NOTE: These fonts are used in this CGM file. You may use the MAP statement to map these fonts to SAS/GRAPH fonts. 1. SIMPLEX 2. BRUSH 3. CENTB 4. CENTBE 5. CENTBI 6. CENTBIE 7. CENTX 8. CENTXE 9. CENTXI 10. CENTXIE 11. GERMAN 12. GITALIC 13. DUPLEX 14. COMPLEX 15. TRIPLEX 16. TITALIC 17. ITALIC 18. OLDENG 19. SCRIPT 20. CSCRIPT 21. SWISS 22. SWISSE 23. SWISSB 24. SWISSBE 25. SWISSBI 26. SWISSBIE 27. SWISSX 28. SWISSXE 29. SWISSXB 30. SWISSXB 31. SWISSXBE 32. SWISSI 33. SWISSIE 34. SWISSL 35. SWISSLE 36. ZAPF 37. ZAPFE 38. ZAPFB 39. ZAPFBE 40. ZAPFBI 41. ZAPFBIE 42. ZAPFI 43. ZAPFIE . . .