Examples


The following examples illustrate major features of the GREPLAY procedure.

Example 1: Creating a Template

Procedure features:

  • GREPLAY statement options:

    • NOFS

    • TC=

  • TDEF statement

  • TEMPLATE statement

Sample library member: GRECRTM1

This example creates a template with five panels. Four of the panels are small and equal in size . The fifth panel is a large, full-size panel that can be used later to display a common title or footnote for the entire template (see ). In this example, the LIST statement displays the template contents in the log. Output 43.1 shows the template definition that is written to the log file. The template that is defined here is also used in Example 2 on page 1272.

Output 43.1: Defining a Template (GRECRTM1)
start example
 .  .  .  64         /* list contents of current template */  65      list template;   NEWTEMP       Five panel template   Pan Clp Color      Ll-x  Ll-y  Ul-x  Ul-y  Ur-x  Ur-y  Lr-x  Lr-y    1      BLUE        0.0  10.0   0.0  50.0  50.0  50.0  50.0  10.0    2      RED         0.0  50.0   0.0  90.0  50.0  90.0  50.0  50.0    3      GREEN      50.0  50.0  50.0  90.0 100.0  90.0 100.0  50.0    4      CYAN       50.0  10.0  50.0  50.0 100.0  50.0 100.0  10.0    5      LIPK        0.0   0.0   0.0 100.0 100.0 100.0 100.0   0.0  66   quit;  .  .  . 
end example
 

Set the graphics environment.

 goptions reset=global gunit=pct border cback=white           colors=(black blue green red)           ftext=swiss htitle=6 htext=3 

Start the GREPLAY procedure. NOFS starts the procedure in line-mode. TC= assigns TEMPCAT as the template catalog.

 proc greplay tc=reflib.tempcat nofs; 

Define a template with four panels. The TDEF statement defines a template named NEWTEMP and places it in the previously defined template catalog. Each definition identifies the panel number and specifies the coordinates of the four corners. The panels are arranged within the template as follows : panel 1 is lower left; panel 2 is upper left; panel 3 is upper right; panel 4 is lower right; panel 5 is the full size so that it can contain a common title and footnote for all the template entries. COLOR= draws a border for each panel in the specified color.

 tdef newtemp des='Five panel template'       1/llx=0   lly=10         ulx=0   uly=50         urx=50  ury=50         lrx=50  lry=10         color=blue       2/llx=0   lly=50         ulx=0   uly=90         urx=50  ury=90         lrx=50  lry=50         color=red       3/llx=50   lly=50         ulx=50   uly=90         urx=100 ury=90         lrx=100 lry=50         color=green       4/llx=50   lly=10         ulx=50  uly=50         urx=100 ury=50         lrx=100 lry=10         color=cyan        5/llx=0   lly=0           ulx=0   uly=100           urx=100 ury=100           lrx=100 lry=0           color=lipk; 

Assign the current template. The TEMPLATE statement assigns the newly created template NEWTEMP as the current template.

 template newtemp; 

Write the contents of the current template to the log.

 list template;  quit; 

Example 2: Replaying Graphics Output in a Template

Procedure features:

  • GREPLAY statement options:

    • GOUT=

    • IGOUT=

    • TEMPLATE=




  • TREPLAY statement

Other features:

  • PROC GSLIDE

Sample library member: GRERGOT1

click to expand

The TREPLAY statement replays into the template NEWTEMP four catalog entries that contain graphics output. The NEWTEMP template is defined in Example 1 on page 1270. It contains four equally sized panels and one large, full-size panel. Note that assignments are made to all but one of the panels. Because the fourth panel is not listed in the TREPLAY statement, it does not appear in the graphics output. The HSIZE= and VSIZE=options are adjusted and then reset to default in order to reflect the dimensions of the different- sized template panels.

Set the graphics environment. HSIZE= and VSIZE= are set for the dimensions of template panels 1, 2, 3, and 4.

 goptions gunit=pct border           cback=white colors=(black blue green red)           ftext=swiss htitle=8 htext=5           hsize=4in vsize=3.8in; 

Generate three graphs in the permanent catalog GRAFCAT. The GSLIDE procedure creates three text slides and stores them in GRAFCAT as specified by the GOUT= option. By default, these are stored as GSLIDE, GSLIDE1, and GSLIDE2.

 proc gslide gout=grafcat;     title c=red 'Graph Number 1';     footnote h=3 j=r 'GRERGOT1(a) ';  run;     title 'Graph Number 2';     footnote h=3 j=r 'GRERGOT1(b) ';  run;     title 'Graph Number 3';     footnote h=3 j=r 'GRERGOT1(c) ';  run; 

Reset HSIZE= and VSIZE= to the default values and generate a text slide with PROC GSLIDE. Resetting the HSIZE and VSIZE values enables you to create a text slide with the proper aspect ratio for use in template panel 5.

 goptions hsize=0in vsize=0in;  proc gslide gout=grafcat;     title 'Common Title';     footnote 'Common Footnote';  run; 

Start the GREPLAY procedure. IGOUT= assigns GRAFCAT as the input catalog. GOUT= assigns EXCAT as the output catalog. TEMPLATE= assigns NEWTEMP as the current template. Remember, the NEWTEMP template is defined in Example 1.

 proc greplay igout=grafcat gout=excat               tc=tempcat nofs;               template=newtemp; 

Write the contents of the current template to the log.

 list template; 

Replay three graphs into template. The TREPLAY statement assigns three entries to panels in the NEWTEMP template. Each assignment is a panel number and the name of a graphics output entry. Names are the default names assigned by the GSLIDE procedure.

 treplay 1:gslide             2:gslide1             3:gslide2             5:gslide3;  quit; 

Example 3: Creating a Color Map

Procedure features:

  • GREPLAY statement option:

    • CC=

    • GOUT=

  • CDEF statement

  • CMAP statement

  • LIST statement

Sample library member: GRECRCM1

This example uses the CDEF statement to define a color map. The LIST statement is used in this example to display the color map definition in the log. Output 43.2 shows a partial listing of the log.

Output 43.2: Defining a Color Map (GRECRCM1)
start example
 .  .  75        /* list the contents of the color map */  76     list cmap;   MYCOLOR       Special Color Map         FROM        TO    1    PINK        RED    2    CYAN        BLUE    3    LIG         GREEN  77  quit;  . 
end example
 

Set the graphics environment.

 goptions reset=global gunit=pct border cback=white           colors=(black blue green red)           ftext=swissb htitle=6 htext=3; 

Start the GREPLAY procedure. CC= assigns CLRMAP as the color map catalog. GOUT= specifies the permanent catalog in which to place the graphics output.

 proc greplay cc=clrmap gout=excat nofs; 

Define a color map. The CDEF statement defines a color map named MYCOLOR that contains three color pairs.

 cdef mycolor des='Special Color Map'       1 / pink  : red       2 / cyan  : blue       3 / lig   : green; 

Specify current color map and write contents to the log. The CMAP statement assigns MYCOLOR as the current color map. The contents of CMAP are listed in the log.

 cmap mycolor;     list cmap;  quit; 



SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net