Data visualization with SAS programming

Space between the bars

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Space between the bars

Hi all

I am not an expert regarding sas graphs but I managed to create a graph based on proc template but I am not there yet. As you can see the picture below I want to move the bar on the left more to the right... I have tried barwidth and ods graphics but it didnt work.

graph.jpg

Any suggestions?

Any help is appriciated.

Thanks

best regards

Johan

My code:

data test;

  input CU_AGE $ MALGRUPPE REFERANSE;

  datalines;

0-17 0.1 0.3

18-25 0.2 0.1

26-35 0.4 0.6

;

proc template;

define statgraph profile_age;

dynamic _NEGATIVE_;

dynamic _ticklist_;

begingraph /;

entrytitle "";

layout overlay / xaxisopts=( griddisplay=on Label="% av målgruppe" offsetmin=0 type=discrete ) yaxisopts=( /*reverse=true*/ display=( ticks tickvalues line ) type=linear ) y2axisopts=(reverse=true);

   if (_NEGATIVE_)   ReferenceLine x=0 / lineattrs=GraphAxisLines;

   endif;

   barchart X='CU_AGE'n Y='MALGRUPPE'n / primary=true orient=vertical LegendLabel="Aldersgruppe" NAME="a" dataskin=PRESSED  target=REFERANSE barlabel=true barwidth=0.1;

   /*ScatterPlot X='TARGET'n Y='CU_GENDER'n / discreteOffset=-0.35 Markerattrs=( Symbol=TRIANGLEDOWNFILLED Size=10) DataTransparency=0.4 LegendLabel="normale population" NAME="t";*/

   DiscreteLegend "a" "t" / Location=outside Title="";

endlayout;

endgraph;

end;

run;

ods graphics on / height=500px width=600px;

proc sgrender data=work.test template=profile_age;

format 'MALGRUPPE'n  percent12.1;

run;

ods graphics off;


Accepted Solutions
Solution
‎05-07-2015 10:07 AM
SAS Super FREQ
Posts: 925

Re: Space between the bars

The OFFSETMIN=0 is what's causing your left bar to clip. either increase the offset (perhaps offsetmin=.05) or just remove the option altogether.

View solution in original post


All Replies
Solution
‎05-07-2015 10:07 AM
SAS Super FREQ
Posts: 925

Re: Space between the bars

The OFFSETMIN=0 is what's causing your left bar to clip. either increase the offset (perhaps offsetmin=.05) or just remove the option altogether.

Occasional Contributor
Posts: 6

Re: Space between the bars

Thank you very much sir Smiley Happy

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 307 views
  • 0 likes
  • 2 in conversation