Data visualization with SAS programming

Cannot show every tick values in PROC TEMPLATE

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Cannot show every tick values in PROC TEMPLATE

Dear all,

 

Not sure why the last tick value 144 at xaxis is not shown in the output. I did specify this value in below:

linearopts=(viewmin=1 viewmax=145 tickvaluelist=(1 2 4 6 8 12 16 24 48 72 96 144))

Look forward for any help!

 

Jacky

 

proc template; 
  define statgraph meanover; 
    begingraph;
      layout lattice / columns=1 rowweights=(0.8 0.2) rowgutter=1 /*columndatarange=unionall*/;
        layout overlay / xaxisopts=(offsetmin=0.01 offsetmax=0.01 TICKVALUEATTRS=(SIZE=8) linearopts=(viewmin=1 viewmax=145 tickvaluelist=(1 2 4 6 8 12 16 24 48 72 96 144))); 
           scatterplot x = atptn y = mean  
                         / /*group = armcd*/ name = "treat" 
                           yerrorlower = LCLM 
                           yerrorupper = UCLM ;
/*                           markersize = 12px; */
           seriesplot  x = atptn y = mean; 
/*                            /   group = armcd;       */
        endlayout; 

        layout overlay / xaxisopts=(type=discrete TICKVALUEATTRS=(SIZE=10) discreteopts=(tickvaluelist=("1" "2" "4" "6" "8" "12" "16" "24" "48" "72" "96" "144")) 
                                    display=(tickvalues)) walldisplay=none;

            blockplot x=atptc block=n /  
                class=trt01a
                repeatedvalues=true
                display=(values);
             drawtext textattrs=(size=8) "Number of Subjects"  / x=0  y=80  justify=left xspace=datavalue yspace=datapercent width=26;
             drawtext textattrs=(size=8) "Timepoint (H)"       / x=0  y=0   justify=left xspace=datavalue yspace=datapercent width=26;
        endlayout;
      endlayout;
    endgraph;
  end; 
run;     

Capture.PNG

 


Accepted Solutions
Solution
‎12-18-2017 03:02 PM
SAS Super FREQ
Posts: 496

Re: Cannot show every tick values in PROC TEMPLATE

See if one of the TICKVALUEFITPOLICY= options helps.

 

TICKVALUEFITPOLICY=policy

specifies a policy for avoiding tick value collision on an axis. The effectiveness of a collision-avoidance policy depends on the number of tick values, their length, and the length of the axis. Which policies are valid depends on the axis on which this option is used. For the Y and Y2 axes, the following policies are valid:

EXTRACT

displays consecutive integers along the axis instead of the actual tick values in order to represent those tick values. In most cases, this policy is implemented if the system estimates that a collision might occur. If no collision occurs, then the actual tick values are displayed on the axis in the normal manner.

Requirement The EXTRACT policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

EXTRACTALWAYS

same as EXTRACT, except that the extraction is implemented regardless of whether collision occurs.

Requirement The EXTRACTALWAYS policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

NONE

makes no attempt to avoid collisions between tick values. Tick values are display even when they collide.

SPLIT

splits the tick value at a split character, which is specified by the TICKVALUESPLITCHAR= option, only when necessary in order to make the value fit the available space. A split does not occur at a split character if a split is not needed at that location. If the value does not contain any of the specified split characters, then the value is not split. Values that are not split or that do not fit the available space even after splitting might overlap the adjoining space.

See TICKVALUESPLITCHAR=

SPLITALWAYS

always splits the axis tick value at every occurrence of a split character that is specified by the TICKVALUESPLITCHAR= option.

See TICKVALUESPLITCHAR=

SPLITALWAYSTHIN

same as SPLITALWAYS, except that thinning is performed when long words do not fit the available space.

SPLITTHIN

same as SPLIT, except that thinning is performed when long words do not fit the available space.

THIN

eliminates alternate tick values.

For the X and X2 axes, the following policies are valid:

EXTRACT

display consecutive integers along the axis instead of the actual tick values to represent those tick values. In most cases, this policy is implemented if the system estimates that a collision might occur. If no collision occurs, then the actual tick values are displayed on the axis in the normal manner.

Requirement The EXTRACT policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

EXTRACTALWAYS

same as EXTRACT, except that the extraction is implemented regardless of whether collision occurs.

Requirement The EXTRACTALWAYS policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

NONE

does not attempt to fit tick values that collide.

ROTATE

rotates the tick values if a collision occurs. The TICKVALUEROTATION= option specifies whether the values are rotated to a 45-degree diagonal or a 90-degree vertical position. By default, the values are rotated to a 45-degree diagonal position.

ROTATEALWAYS

rotates the tick values regardless of whether a collision occurs. The TICKVALUEROTATION= option specifies whether the values are rotated to a 45-degree diagonal or a 90-degree vertical position. By default, the values are rotated to a 45-degree diagonal position.

ROTATEALWAYSDROP

attempts the ROTATEALWAYS policy, and then drops the tick values if collisions still occur.

ROTATETHIN

attempts the ROTATE policy, and then the THIN policy.

SPLIT

splits the tick value at a split character, which is specified by the TICKVALUESPLITCHAR= option, only when necessary in order to make the value fit the available space. A split does not occur at a split character if a split is not needed at that location. If the value does not contain any of the specified split characters, then the value is not split. Values that are not split or that do not fit the available space even after splitting might overlap the adjoining space.

See TICKVALUESPLITCHAR=

SPLITALWAYS

always splits the axis tick value at every occurrence of a split character that is specified by the TICKVALUESPLITCHAR= option.

See TICKVALUESPLITCHAR=

SPLITROTATE

attempts the SPLIT policy, and then the ROTATE policy.

STACKEDALWAYS

always displays the tick values vertically as stacked letters.

Note: This feature applies to SAS 9.4M5 and to later releases.

STACKEDALWAYSTHIN

always displays the tick values vertically as stacked letters. Thinning is performed when the tick values do not fit the available space.

Note: This feature applies to SAS 9.4M5 and to later releases.

STAGGER

alternates the tick values between two rows.

STAGGERROTATE

attempts the STAGGER policy, and then the ROTATE policy.

STAGGERTHIN

attempts the STAGGER policy, and then the THIN policy.

STAGGERTRUNCATE

attempts the STAGGER policy, and then the TRUNCATE policy.

THIN

eliminates alternate tick values.

TRUNCATE

shortens the tick values when they exceed a certain number of characters.

TRUNCATEROTATE

attempts the TRUNCATE policy, and then the ROTATE policy.

TRUNCATESTAGGER

attempts the TRUNCATE policy, and then the STAGGER policy.

TRUNCATETHIN

attempts the TRUNCATE policy, and then the THIN policy.

Default ROTATE for the X and X2 axes
THIN for the Y and Y2 axes
Note A note is written to the SAS log when tick value thinning occurs.

View solution in original post


All Replies
Solution
‎12-18-2017 03:02 PM
SAS Super FREQ
Posts: 496

Re: Cannot show every tick values in PROC TEMPLATE

See if one of the TICKVALUEFITPOLICY= options helps.

 

TICKVALUEFITPOLICY=policy

specifies a policy for avoiding tick value collision on an axis. The effectiveness of a collision-avoidance policy depends on the number of tick values, their length, and the length of the axis. Which policies are valid depends on the axis on which this option is used. For the Y and Y2 axes, the following policies are valid:

EXTRACT

displays consecutive integers along the axis instead of the actual tick values in order to represent those tick values. In most cases, this policy is implemented if the system estimates that a collision might occur. If no collision occurs, then the actual tick values are displayed on the axis in the normal manner.

Requirement The EXTRACT policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

EXTRACTALWAYS

same as EXTRACT, except that the extraction is implemented regardless of whether collision occurs.

Requirement The EXTRACTALWAYS policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

NONE

makes no attempt to avoid collisions between tick values. Tick values are display even when they collide.

SPLIT

splits the tick value at a split character, which is specified by the TICKVALUESPLITCHAR= option, only when necessary in order to make the value fit the available space. A split does not occur at a split character if a split is not needed at that location. If the value does not contain any of the specified split characters, then the value is not split. Values that are not split or that do not fit the available space even after splitting might overlap the adjoining space.

See TICKVALUESPLITCHAR=

SPLITALWAYS

always splits the axis tick value at every occurrence of a split character that is specified by the TICKVALUESPLITCHAR= option.

See TICKVALUESPLITCHAR=

SPLITALWAYSTHIN

same as SPLITALWAYS, except that thinning is performed when long words do not fit the available space.

SPLITTHIN

same as SPLIT, except that thinning is performed when long words do not fit the available space.

THIN

eliminates alternate tick values.

For the X and X2 axes, the following policies are valid:

EXTRACT

display consecutive integers along the axis instead of the actual tick values to represent those tick values. In most cases, this policy is implemented if the system estimates that a collision might occur. If no collision occurs, then the actual tick values are displayed on the axis in the normal manner.

Requirement The EXTRACT policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

EXTRACTALWAYS

same as EXTRACT, except that the extraction is implemented regardless of whether collision occurs.

Requirement The EXTRACTALWAYS policy must be used with an AXISLEGEND statement. For more information, see Extracting Discrete Axis Tick Values into a Legend in SAS Graph Template Language: User’s Guide.

NONE

does not attempt to fit tick values that collide.

ROTATE

rotates the tick values if a collision occurs. The TICKVALUEROTATION= option specifies whether the values are rotated to a 45-degree diagonal or a 90-degree vertical position. By default, the values are rotated to a 45-degree diagonal position.

ROTATEALWAYS

rotates the tick values regardless of whether a collision occurs. The TICKVALUEROTATION= option specifies whether the values are rotated to a 45-degree diagonal or a 90-degree vertical position. By default, the values are rotated to a 45-degree diagonal position.

ROTATEALWAYSDROP

attempts the ROTATEALWAYS policy, and then drops the tick values if collisions still occur.

ROTATETHIN

attempts the ROTATE policy, and then the THIN policy.

SPLIT

splits the tick value at a split character, which is specified by the TICKVALUESPLITCHAR= option, only when necessary in order to make the value fit the available space. A split does not occur at a split character if a split is not needed at that location. If the value does not contain any of the specified split characters, then the value is not split. Values that are not split or that do not fit the available space even after splitting might overlap the adjoining space.

See TICKVALUESPLITCHAR=

SPLITALWAYS

always splits the axis tick value at every occurrence of a split character that is specified by the TICKVALUESPLITCHAR= option.

See TICKVALUESPLITCHAR=

SPLITROTATE

attempts the SPLIT policy, and then the ROTATE policy.

STACKEDALWAYS

always displays the tick values vertically as stacked letters.

Note: This feature applies to SAS 9.4M5 and to later releases.

STACKEDALWAYSTHIN

always displays the tick values vertically as stacked letters. Thinning is performed when the tick values do not fit the available space.

Note: This feature applies to SAS 9.4M5 and to later releases.

STAGGER

alternates the tick values between two rows.

STAGGERROTATE

attempts the STAGGER policy, and then the ROTATE policy.

STAGGERTHIN

attempts the STAGGER policy, and then the THIN policy.

STAGGERTRUNCATE

attempts the STAGGER policy, and then the TRUNCATE policy.

THIN

eliminates alternate tick values.

TRUNCATE

shortens the tick values when they exceed a certain number of characters.

TRUNCATEROTATE

attempts the TRUNCATE policy, and then the ROTATE policy.

TRUNCATESTAGGER

attempts the TRUNCATE policy, and then the STAGGER policy.

TRUNCATETHIN

attempts the TRUNCATE policy, and then the THIN policy.

Default ROTATE for the X and X2 axes
THIN for the Y and Y2 axes
Note A note is written to the SAS log when tick value thinning occurs.
Occasional Contributor
Posts: 7

Re: Cannot show every tick values in PROC TEMPLATE

Posted in reply to WarrenKuhfeld

Hello Warren,

 

Does TICKVALUEFITPOLICY option fit for SAS EG 5.1(equivalent SAS BASE 9.3)?

 

I add this option and returning error in log..

 

Thanks,

Jacky

SAS Super FREQ
Posts: 496

Re: Cannot show every tick values in PROC TEMPLATE

It is a GTL option.  It is in 9.3.  Google: tickvaluefitpolicy 9.3

to see what options are supported in that release.

Occasional Contributor
Posts: 7

Re: Cannot show every tick values in PROC TEMPLATE

[ Edited ]
Posted in reply to WarrenKuhfeld

Much apprecated! I tried STAGGERTHIN and 144 is shown. I am still wondering why it's not shown if I do not specify this option, since there is enough space to show the last tick...

 

And in another similar outputs, I have 1 more tick at 0, and in that output I don't specify the TICKVALUEFITPOLICY option and 144 is shown...

 Capture.PNG

SAS Super FREQ
Posts: 496

Re: Cannot show every tick values in PROC TEMPLATE

Glad it helped!  Since you did not provide full code, I can't play with it.  It might be because 144 is so close to your viewmax=145.

Occasional Contributor
Posts: 7

Re: Cannot show every tick values in PROC TEMPLATE

Posted in reply to WarrenKuhfeld
I did try VIEWMAX=150, 200, and 144 is not shown as well... But you can see my edited response, if there is another tick start at 0, 144 is shown, without TICKVALUEFITPOLICY option...
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 233 views
  • 0 likes
  • 2 in conversation