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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 1208 views
  • 0 likes
  • 2 in conversation