Multi Value Format Problem : GTL

Reply
Occasional Contributor
Posts: 17

Multi Value Format Problem : GTL

Hi All,

This is my first time at here and i have stacked a problem regarding GTL (Graphical Template language) from last couple of days.

-Major problem is that while using same formatted value (say for example: "Pos" for y-axis=0.2,1.2.. ) , BAR is overlapping on the Graph

-i have also tried with TICKVALUELIST on Y-AXIS but it seems SCATTERPLOT after BAR-CHART is not working on OVERLAY and generated warning

-For better understanding, i have given the code and output hereby

Output:

-From the attached output (test.png); you will see where Formatted Values is repeated at Y-Axis is overlapping

Code:

  PROC FORMAT;

    VALUE trtsdf

    0.2="pos"

    0.4="unc"

    0.6="neg"

    0.8="x 200 mg"

    1.2="pos"

    1.4="unc"

    1.6="neg"

    1.8="x 400 mg"

    ;

    VALUE trtsdf

    0.2=" 12 (4.67%)"

    0.4=" 11 (8.03%)"

    0.6=" 13 (23.31%)"

    0.8=" 61 (  100%)"

    1.2="  8 (5.69%)"

    1.4=" 10 (26.61%)"

    1.6="  8 (76.69%)"

    1.8=" 51 (  100%)"

  QUIT;

   PROC template;

    DEFINE STATGRAPH gtplot;

    BEGINGRAPH;

    LAYOUT OVERLAY / XAXISOPTS=(label=" "

                     linearopts=(tickvaluesequence=(start=-5 end=0 increment=1)))

                     YAXISOPTS=(label="Treatment / Dose")

                     Y2AXISOPTS=(label="N(%)");

     BARCHART y=estimate x=paramn  / GROUP=paramn BARWIDTH=0.4  NAME="bar" ORIENT=horizontal

          FILLATTRS=(COLOR = LIGHTGREY) DATATRANSPARENCY=0.7;

     SCATTERPLOT x=estimate  y=paramn  / GROUP=paramn XERRORLOWER=eval(estimate-standard)

     ERRORBARATTRS=(thickness=1)

     LEGENDLABEL="Results" NAME="SCATTER"

     MARKERATTRS=(color=black size=0);

     BARCHART y=estimate x=paramn1 / GROUP=paramn BARWIDTH=0.4 PRIMARY=no NAME="bar1"

                                     ORIENT=horizontal YAXIS=y2

                                     FILLATTRS=(COLOR = LIGHTGREY) DATATRANSPARENCY=0.7 ;

     ENDLAYOUT;

    ENDGRAPH;

    END;

  RUN;

  PROC SGRENDER DATA=uni_api TEMPLATE="gtplot";

    format paramn trtsdf. paramn1 trtpf.;

  RUN;

  

-Waiting for your kind Reply and thanks in advance

Sami


test.png
SAS Super FREQ
Posts: 8,862

Re: Multi Value Format Problem : GTL

Hi,

It would be better for you to post this question in the forum specifically for ODS GRAPHICS questions (which includes GTL questions). The developers who work on ODS GRAPHICS and GTL generally monitor that forum area. Here's the URL:

https://communities.sas.com/community/support-communities/sas_graph_and_ods_graphics

Or, alternately, you would open a track with Tech Support directly on this. They could look at your code and your data and help you with a resolution.

I do note that you have a semi-colon missing for your second VALUE statement in the PROC FORMAT step (before the QUIT; statement). I would also suggest that you add the FMTLIB option to your PROC FORMAT step:

PROC FORMAT FMTLIB;

...in order to verify that your format is being created correctly with the values you want.

Aside from any GTL issues, the way you define your format is NOT a multi-value  or multi-label format. The second definition in your code will override the first definition. To verify format behavior separate from the GTL question (which you have to fix first), please run the program below. You can see the output that is produced in the screen shot. Format creation is not "additive" -- if the format already exists when another VALUE statement is encountered with the same name as an existing format, the new format definition replaces the original format definition with the same name. There is a way to define a multi-label format (MLF), but only certain procedures support multi-label formats and I do not know whether the ODS GRAPHICS procedures support them. That is also a question for Tech Support.

To see how to define multi-label formats, please refer to this doc:

Base SAS(R) 9.4 Procedures Guide

(2nd screen shot)

Cynthia

title;
ods html file='c:\temp\what_is_in_format.html' style=sasweb;
PROC FORMAT fmtlib;
    VALUE myfmt
    11="eleven"
    12="twelve"
    13="thirteen"
    ;
 
    VALUE myfmt
    11="wombat"
    12="koala"
    13="eucalyptus"
    ;
run;
     
proc freq data=sashelp.class;
where age le 13;
title 'What is Format Value';
  tables age;
  format age myfmt.;
run;
ods html close;


multi_label_format_from_doc.pnguse_same_format_name_twice.png
Occasional Contributor
Posts: 17

Re: Multi Value Format Problem : GTL

Posted in reply to Cynthia_sas

Hi Cynthia,


Thanks, I have posted my question to the GTL monitoring forum as per your suggestion. Actually Format was not my concern, my concern is why GTL overlapping Format values on Graph.


Kind Regards

Sami

Ask a Question
Discussion stats
  • 2 replies
  • 213 views
  • 0 likes
  • 2 in conversation