BookmarkSubscribeRSS Feed
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

I am trying to create a custom style that is based on JOURNAL3, but I am unable to reduce the weight of the crosshatch lines. In short, I want to apply crosshatch lines to one response value for a variable that has 6 values. I am using the following code to create the template and set up the attribution map data set to apply the crosshatch lines to the level defined by GRAPHDATA6. However, I do not know which style attribute controls the weight of the crosshatch lines that are part of this style. I have tried using TRANSPARENCY= but this has not made a difference in the output. Which attribute would I use in the line of the PROC TEMPLATE code that defines the style attributes for GRAPHDATA6?

 

proc template; 
    define style styles.BTRFLY; 
    parent = styles.journal3; 
    style GraphData1 from GraphData1 / 
        fillpattern = "solid";
    style GraphData2 from GraphData2 / 
        fillpattern = "solid"; 
    style GraphData3 from GraphData3 / 
        fillpattern = "solid"; 
    style GraphData4 from GraphData4 / 
        fillpattern = "solid"; 
	 style GraphData5 from GraphData5 / 
        fillpattern = "solid"; 
    style GraphData6 from GraphData6 / 
        fillpattern = "X1" ; /*THIS IS THE LEVEL WITH CROSSHATCH LINES*/ 
    end;
/*run; */;

ods listing style=BTRFLY image_dpi=300 gpath="&path.\Figures\";

data attrmap;
    length ID $ 8 Value $ 35 fillstyle $ 10;
    infile datalines delimiter='|';
    input ID Value fillstyle ;
    datalines;
response|Does not exist at school/district|GraphData6
response|Never|GraphData5
response|1-2 times a year|GraphData4
response|3-6 times a year|GraphData3
response|1-2 times each month|GraphData2
response|Every week|GraphData1
    ;
run;

 

5 REPLIES 5
DanH_sas
SAS Super FREQ

Is this what you want?

 

data test;
do x=1 to 4;
   do g=1 to 6;
     y=ranuni(123);
     output;
   end;
end;
run;

proc template;
define style styles.btrfly;
parent=styles.journal3;
style graphdata1 from graphdata1 / fillpattern="s";
style graphdata2 from graphdata2 / fillpattern="s";
style graphdata3 from graphdata3 / fillpattern="s";
style graphdata4 from graphdata4 / fillpattern="s";
style graphdata5 from graphdata5 / fillpattern="s";
style graphdata6 from graphdata6 / fillpattern="x1";
end;
run;
ods graphics / attrpriority=none;
ods html style=btrfly;

data attrmap;
retain id "myid";
input value $ fillstyle $;
cards;
1 GraphData1
2 GraphData2
3 GraphData3
4 GraphData4
5 GraphData5
6 GraphData6
;
run;

proc sgplot data=test dattrmap=attrmap;
vbar x / response=y group=g fillpattern attrid=myid groupdisplay=cluster;
run;

ods html close;
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

Not exactly--what I'm trying to find out is if there is an attribute that reduces the weight of the crosshatch lines. I am using datalabels within a horizontal stacked bar chart, so a fainter crosshatch would be nicer. Perhaps that cannot be done with STYLE-JOURNAL3. 

DanH_sas
SAS Super FREQ

To control the thickness of the fill pattern lines, you should do as @BrunoMueller described. Another option is to change the color from black to a lighter shade of gray. Given your use case, I would probably go towards the color approach.

BrunoMueller
SAS Super FREQ

Have a look at the doc here https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/p0yjbi9rz0z03tn1arz9ia9tgvic.h... 

You can choose the L1 to L5 R1 to R5 and X1 to X5 

 

So you would use something like:

style GraphData6 from GraphData6 /
      fillpattern = "R2";

 

Additionally you can look at an existing style definition using the following code. The EXPAND option will also print the parent style definitions.

proc template; 
source styles.journal3 / expand ; 
run;
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

Circling back here to say that I figured out my problem: I needed to assign a light color in the DATACONTRASTCOLORS statement to put a white crosshatch on a gray bar. This way, the segment label is made visibile. Here is the segment of the SGPLOT code that I needed to change. Thank you for your suggestions. 

 

   styleattrs datacolors=( CX00354c CX004c6d  CX6996b3 CXc1e7ff CXbbbbbb CXdddddd   )
               datacontrastcolors=(CXffffff CX004c6d  CX6996b3 CXc1e7ff CXbbbbbb CXdddddd   ); /*The white color in the first position changes the crosshatch*/

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 5 replies
  • 660 views
  • 0 likes
  • 3 in conversation