SVGVIEWBOX= System Option

Specifies the coordinates, width, and height that are used to set the viewBox attribute on the outermost <svg> element, which enables SVG output to scale to the viewport.
Valid in: Configuration file, SAS invocation, OPTIONS statement, SAS System Options window
Category: Log and procedure output control: SVG
PROC OPTIONS GROUP= SVG
Restriction: The SVGVIEWBOX= option sets the viewBox attribute only on the outermost <svg> element.
Note: This option can be restricted by a site administrator. For more information, see Restricted Options.

Syntax

SVGVIEWBOX="min-x min-y width height'' | none | "" | ''

Syntax Description

min–x
specifies the beginning x coordinate of the viewBox, in user units.
Requirement:min-x can be 0, or a positive or a negative integer value.
min–y
specifies the beginning y coordinate of the viewBox, in user units.
Requirement:min–y can be 0, or a positive or negative integer value.
width
specifies the width of the viewBox, in user units.
Requirement:width must be a positive integer value.
height
specifies the height of the viewBox, in user units.
Requirement:height must be a positive integer value.
none
specifies that no viewBox attribute is to be specified on the outermost <svg> element, which will effectively create a static SVG document.
"" | ''
specifies to reset the width and height of the viewBox to the width and height of the paper size for the SVG printer.
Requirement:Use two double quotation marks or two single quotation marks with no space between them.

Details

When the viewBox attribute is specified, the SVG output is scaled to be rendered in the viewport and the current coordinate system is updated to be the dimensions that are specified by the viewBox attribute. If it is not specified, the viewBox attribute on the outermost <svg> element sets the height and width arguments of the viewBox attribute to the paper height and paper width as defined by the PAPERSIZE= system option.
The coordinates, width, and height of the viewBox attribute should be mapped to the coordinates, width, and height of the viewport, taking into account the values of the preserveAspectRatio attribute.
The value for the SVGVIEWBOX= option must be enclosed in single or double quotation marks, or enclosed in parentheses.
You can use a negative value for min-x and min-y to place the SVG document in the output. A negative value of min-x shifts the output to the right. A negative value of min-y shifts the placement of the output downward.

Example

The following OPTIONS statement specifies to scale the output to a width of 100 user units and a height of 200 user units:
options printerpath=svg svgviewbox="0 0 100 200" dev=sasprtc;
By using these option values, SAS creates the following <svg> element:
<svg> xmlns="http://www.w3.org/2000/svg" 
      xmlns:xlink="http://www.w3.org/1999/xlink" 
      xml:space="preserve" 
      onload='Init(evt)' version="1.1"  
      viewBox="0 0 100 200" 
</svg>