Hello. I have a question. I want to create a bar graph by subgroup. This below the code is working well, but I want to change the transparency of all AMR bars but not the color (AIR should be no transparent). Can anyone help with it? Thank you so much. ************** SAS code; GOPTIONS RESET=ALL DEVICE=PNG TARGET=PNG HSIZE=8in VSIZE=7in FTITLE='Albany AMT/bold' FTEXT='Albany AMT/bold' HTITLE=1.75 HTEXT=1.5; data mileage; input age & $15. sex $ amount sam & $15.; call execute(catt('pattern',_N_,'color='('red','violet','BIGB','grey','STGB'),';'); datalines; All sites M 500 , n=2812(100%) All sites F 400 , n=1044(100%) Female breast M 50 , n=554(20%) Female breast F 5 , n=89(9%) Male prostate M 110.0 , n=332(12%) Male prostate F 10 , n=74(7%) Lung & bronchus M 40 , n=242(9%) Lung & bronchus F 35 , n=186(18%) Colon & rectum M 45 , n=231(8%) Colon & rectum F 70 , n=102(10%) ; run; data convert; set mileage; if sex='M' then amount=-amount; run; proc format; picture posval low-high='000,009'; run; data anlabels(drop=age sex ); length text color $ 50; retain function 'label' when 'a' xsys ysys '2' hsys '3' size 2.5; set convert; midpoint=age; subgroup=sex; text=strip(""||strip(left(put(amount,posval.)))||left(sam)); /*if age='All sites' then color='red';*/ /*else if age='Female breast' then color='violet';*/ /*else if age='Male prostate' then color='BIGB';*/ /*else if age='Lung & bronchus' then color='grey';*/ /*else color='STGB'; */ /* */ /* POSITION changes to place label outside of bar if bar is too small. */ if amount ge -115 and sex='M' then position='<'; else if sex='M' then position='>'; /* POSITION changes to place label outside of bar if bar is too small. */ if amount le 115 and sex='F' then position='>'; else if sex='F' then position='<'; output; run; /* Add a title to the graph */ title1 ''; axis1 label=(justify=left '') style=0 value=(f="Albany AMT/bold" h=1.5); axis2 label=none value=( h=10pt) minor=none major=none width=3 order=(-440 to 160 by 40) value=(f="Albany AMT/bold" h=1); pattern1 v=solid color=red; pattern2 v=solid color=STGB; pattern3 v=solid color=violet; pattern4 v=solid color=grey; pattern5 v=solid color=BIGB; /*pattern1 color = white;*/ /*pattern2 color = white;*/ proc gchart data=convert; format amount posval.; note font="Albany AMT/bold" move=(22pct,65pct) h=12pt 'AIR' move=(80pct,65pct) 'AMR'; hbar age / sumvar=amount discrete nostat subgroup=sex SPACE =1 WIDTH =2 maxis=axis1 raxis=axis2 nolegend annotate=anlabels patternid=subgroup patternid=midpoint ; run; quit;
... View more