BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JohanFu
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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

2 REPLIES 2
DanH_sas
SAS Super FREQ

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.

JohanFu
Fluorite | Level 6

Thank you very much sir Smiley Happy

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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