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

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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