BookmarkSubscribeRSS Feed
KevinViel
Pyrite | Level 9

I am achieving a series plot with markers in GTL:

 

proc template ;

  define statgraph series_scatter ;

    dynamic _X
            _Y
            _Curve
            _Group
            ;

    begingraph
             / border             = false
               datacolors         = ( Black
                                      Red
                                      Blue
                                      Aqua
                                      Magenta
                                      Orange
                                    )
               datalinepatterns   = ( Solid
                                      ShortDash
                                      MediumDash
                                      LongDash
                                      MediumDashShortDash
                                      DashDashDot
                                      DashDotDot
                                      Dash
                                      LongDashShortDash
                                      Dot
                                      ThinDot
                                      ShortDashDot
                                      MediumDashDotDot
                                    )
               datasymbols        = ( CircleFilled
                                      TriangleFilled
                                      TriangleDownFilled
                                      DiamondFilled
                                      SquareFilled
                                      Plus
                                      x
                                      Asterisk
                                      Circle
                                      Triangle
                                      TriangleDown
                                      Diamond
                                      Square
                                    )
               axisbreaktype      = axis
               axisbreaksymbol    = bracket
               ;

      layout overlay
           /
             xaxisopts = ( label             = "Time (Days)"
                           type              = linear
                            linearopts        = ( tickvaluelist   = ( 0 1 2 3 4 7 14 28 )
                                                  tickdisplaylist = ( "Baseline" "Day 1" "Day 2" "Day 3" "Day 4" "Day 7" "Day 14" "Day 28" )
                                                 )
                           offsetmin         = 0.05
                           offsetmax         = 0.05
                         )
             yaxisopts = ( label             = "Label"
/*                           type              = linear*/
                           linearopts        = ( includeranges     = ( 0 - 90  820 - 840 ))
                           offsetmin         = 0.025
                           offsetmax         = 0.025
                         )
             ;

        seriesplot x = _X
                   y = _Y
                 / group = _Group
                   name  = "series"
/*                   primary     = true */
                   ;

        scatterplot x = _X
                    y = _Y
                  / group       = _Group
                    name        = "scatter"
                    markerattrs = ( size = 5 )
                    ;

        referenceline y = 0
                    / lineattrs = ( thickness = 1
                                    color     = black
                                    pattern   = dash
                                  )
                      curvelabel = "LLN = 0"
                      ;

        referenceline y = 60
                    / lineattrs = ( thickness = 1
                                    color     = black
                                    pattern   = dash
                                  )
                      curvelabel = "ULN = 60"
                      ;

        mergedlegend "scatter"
                     "series"
                   / border = true
                     title  = " "
                     ;

      endlayout ;

    endgraph ;

  end ;

run ;

ods listing close ;
options orientation = landscape topmargin = 0.75in bottommargin = 0.75in rightmargin = 0.75in leftmargin = 0.75in ;
ods results ;
ods rtf file = "~\test.rtf" style = styles.custom nogtitle nogfootnote ;

ods graphics on
  / height = 3.5in
    width  = 9in
    border = off
    ;

proc sgrender
   data      = &outsas.
   template  = series_scatter
   ;

   dynamic _X      = "avisit"
           _Y      = "aval"
           _Group  = "subjid"
           ;

  by studyid
     dose
     ;

run ;

ods rtf close ;
ods listing ;

The issue is that the Days are evenly spaced as if nominal:

 

xaxis.jpg

If I add TYPE = LINEAR (uncomment above), then I get the following:

 

WARNING: SERIESPLOT statement has a conflict with the axis type. The plot will not be drawn.
WARNING: SCATTERPLOT statement has a conflict with the axis type. The plot will not be drawn.

 

I have tried changing the order of SERIESPLOT and SCATTERPLOT statements and added PRIMARY = TRUE to the the SERIESPLOT.  Any corrections, references, or suggestions are welcomed.

 

Thank you,

 

Kevin

 

3 REPLIES 3
ballardw
Super User

Can't test anything without data.

 

Did you try commenting out the TYPE=LINEAR for the XAXISOPTS?

KevinViel
Pyrite | Level 9

Doh!

 

The issue is that I used the WRONG variable for _X:

 


data test ;
  retain studyid "1"
         dose    "1"
         ;

  length subjid $ 4 ;
  do subjid = "1" , "2" , "Mean" ;
    do avisitn = 0 , 1 , 2 , 3 , 4 , 7 , 14 , 28 ;
      aval = 10 * ranuni( 1 ) ;
      output ;
    end ;
  end ;
run ;

proc sgrender
   data      = test
   template  = series_scatter
   ;

   dynamic _X      = "avisitn"
           _Y      = "aval"
           _Group  = "subjid"
           ;

  by studyid
     dose
     ;

run ;

AVISIT is the character version of AVISITN.

 

Now, I am on to other (real) issues 🙂

 

Many thanks,

 

Kevin

ballardw
Super User

Glad you found the solution.

 

I wish I could say I haven't made a similar mistake of variable name in the past year sometime. Wish, can't say it truthfully...

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 941 views
  • 1 like
  • 2 in conversation