BookmarkSubscribeRSS Feed
sam1231
Obsidian | Level 7
I AM using sgrender to do line chart by grp and i need table below plot. this works fine but i want table font color match with line color in plot. how to do that?
 
proc template;
   define statgraph lineblock;
   begingraph;
 
      layout lattice / rowweights=(.70 .10 .20);
        /* Line Chart */
         layout overlay / xaxisopts=(label="axp") 
                          yaxisopts=(label="percentage (%) " );
    seriesplot  x=axp y=pchg / group=grp name="stdy"
                        lineattrs=(thickness=2 pattern=solid) 
                        dataskin=gloss;
 
    scatterplot x=axp y=pchg / markerattrs=(symbol=circlefilled size=8);
 
         endlayout;
 
         /* Block Plot */
         layout overlay / xaxisopts=(type=discrete display=none )  walldisplay=none;
    blockplot x=axp block=block / class=grp 
                      display=(values label) 
  valueattrs=(color=color)
                      repeatedvalues=true;
endlayout;
 
      endlayout;
   endgraph;
   end;
run;

 

4 REPLIES 4
Ksharp
Super User
It would be better if you could post your sample data and PROC SGRENDER and desired output.
DanH_sas
SAS Super FREQ

You might want to use an AXISTABLE here instead of a BLOCKPLOT to create this table. AXISTABLES can do exactly what you asked, but as @Ksharp said, we need a little more information to determine if that solution will wrk for you.

sam1231
Obsidian | Level 7

sam1231_0-1742836104683.png

I want font color in table same as font color in plot. 

 

code: 

proc template;
   define statgraph barblock;
   begingraph;
      entrytitle 'Total Sales Across Regions';
      layout lattice / rowweights=(.65 .35);
         layout overlay;
seriesplot  x=region y=sales / group=product name='stdy'
    ;
scatterplot x=region y=sales / markerattrs=(symbol=circlefilled size=8);
discretelegend "stdy" / title= " " titleattrs= (size=9pt weight=normal ) location=
inside halign=right valign=top
valueattrs= (size=9pt) border=false;
         endlayout;
 
layout overlay / xaxisopts=(type=discrete label='Number of Stores per Region' 
                          display=(label)) walldisplay=none;
    blockplot x=region block=stores / class=product display=(outline values label) 
                                              repeatedvalues=true;
endlayout;
      endlayout;
   endgraph;
   end;
run;
Ksharp
Super User

As DanH_sas said try XAXISTABLE . Here is an example for proc sgplot, but you could find the similar statement in GTL.

 

data cars;
set sashelp.cars;
run;

proc sql;
create table have as
select origin,type,sum(invoice) as invoice,count(*) as count
 from cars
  group by origin,type;
quit;

proc sgplot data=have;
series x=type y=invoice/group=origin markers markerattrs=(symbol=circlefilled);
keylegend /location=inside position=ne across=1;
xaxistable count/x=type class=origin colorgroup=origin;
run;

Ksharp_0-1742866886607.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 873 views
  • 2 likes
  • 3 in conversation