Data visualization with SAS programming

Dynamic Scatter Plot --Proc Sgrender

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Dynamic Scatter Plot --Proc Sgrender

I would like to set the Yaxis  start and end values to 15Sep2013 and 30Sep2013. I would like to see the activity for each day. what should be the increment value then? I have it as 1. But it is not working. Thanks.

The code i am using is below:

proc template;

  define statgraph dyn_scatter;

    dynamic _x _y _grp _valign;

    begingraph;

      entrytitle '_x';

      layout overlay/yaxisopts=(label='Month' linearopts=(tickvaluesequence=(start="15Sep2013"d end="30Sep2013"d increment=1)))

  xaxisopts=(label='Check Amount' linearopts=(tickvaluesequence=(start=0 end=200000 increment=20000) viewmin=0 ));

        scatterplot x=check_amount y=date / group=status datatransparency=0.1

               name='a' markerattrs=(symbol=circlefilled size=10);

        if (exists(_grp))

          discretelegend 'a' / location=inside

              valign=_valign halign=right across=1;

        endif;

      endlayout;

    endgraph;

  end;

run;

proc sgrender data=CRO_Final_Paymentfile template=dyn_scatter;

dynamic _x='Check_Amount' _y='Date' _grp='Status' _valign='Top';

run;

Attachment

Accepted Solutions
Solution
‎05-01-2014 09:40 AM
SAS Super FREQ
Posts: 1,044

Re: Dynamic Scatter Plot --Proc Sgrender

It is hard to say what is going on without the data.  Please attach data.

If the variable "Date" has a SAS time format, then your Y axis will be of TYPE=Time by default, and you should use the TIMEOPTS bundle, with VIEWMIN, VIEWMAX and INTERVAL..

View solution in original post


All Replies
Solution
‎05-01-2014 09:40 AM
SAS Super FREQ
Posts: 1,044

Re: Dynamic Scatter Plot --Proc Sgrender

It is hard to say what is going on without the data.  Please attach data.

If the variable "Date" has a SAS time format, then your Y axis will be of TYPE=Time by default, and you should use the TIMEOPTS bundle, with VIEWMIN, VIEWMAX and INTERVAL..

Occasional Contributor
Posts: 14

Re: Dynamic Scatter Plot --Proc Sgrender

I have date values which i plotted along Y axis in date9. format. the date values range from 17Sep2013 to 15Apr2014. Thanks Sanjay!

Occasional Contributor
Posts: 14

Re: Dynamic Scatter Plot --Proc Sgrender

Thanks Sanjay. Timeopts worked.

Occasional Contributor
Posts: 14

Re: Dynamic Scatter Plot --Proc Sgrender

is there an option to set the color for variable used with group ? i have 3 different values for the group=status variable. I dont like the default colorsSmiley Happy. Thanks.

proc template;

  define statgraph dyn_scatter;

    dynamic _x _y _grp _valign;

    begingraph;

      entrytitle 'Check Activity Month 1';

      layout overlay/xaxisopts=(linearopts=(tickvalueformat=Dollar12. viewmin=0 viewmax=250000 tickvaluelist=(25000 50000 100000 150000 200000 205000 )))

  yaxisopts=(timeopts=(tickvalueformat=date9. viewmin="15Sep2013"d viewmax="15Oct2013"d tickvaluelist=("15Sep2013"d "30Sep2013"d "15Oct2013"d )));

        scatterplot x=check_amount y=date / group=status datatransparency=0.2 name='a' markerattrs=(symbol=trianglefilled size=10);

        if (exists(_grp)) discretelegend 'a' / location=inside

              valign=_valign halign=right across=1;

        endif;

      endlayout;

    endgraph;

  end;

run;

Grand Advisor
Posts: 9,748

Re: Dynamic Scatter Plot --Proc Sgrender

Colors are defined in the ODS style active when making the graph. Either try other styles or make a custom one with desired colors. You'll need to check with the documentation as to which elements to change as some use graphdatacolor and some use contrastcolor.

SAS Super FREQ
Posts: 1,044

Re: Dynamic Scatter Plot --Proc Sgrender

For those using SAS 9.4 or later, group colors (and symbols and line patterns) can be defined in the SG (StyleAttrs) or GTL (BeginGraph) code.  So, while deriving a custom style is still a good way, it is no longer necessary.

Generally, filled areas (Bars, Bands, etc.) use DATACOLORS and lines and markers use DATACONTRASTCOLOR.

Post a Question
Discussion Stats
  • 6 replies
  • 576 views
  • 0 likes
  • 3 in conversation