Data visualization with SAS programming

Need help! To get the values inside the bars with center alignment

Reply
New Contributor
Posts: 2

Need help! To get the values inside the bars with center alignment

[ Edited ]

Hello all,

 

Here am facing an issue to get the values inside the bars with center alignment. 

Following is the code that I have used for getting those values inside the bars but couldn't able to get them center aligned. Any help please?

 

scatter x= Months_from_initial_diagnosis_to y= subjid /markerchar=Months_from_initial_diagnosis_to markercharattrs=(family='arial' color=black weight=bold size=8pt);

scatter x=Months_from_administrat y= subjid / markerchar = Months_from_administrat markercharattrs=(family='arial' color=black weight=bold size=8pt) Capture.JPG

Super User
Posts: 22,874

Re: Need help! To get the values inside the bars with center alignment

Did you try DATALABELS instead on the _BAR statement? You can apply the CENTER option to those which seems like it would be an option.

 

Otherwise I think you'll need to adjust your X coordinate, pad it with a few months or calculate the center where it should be located and use that as the X location instead. 

 


pavansvc wrote:

Hello all,

 

Here am facing an issue to get the values inside the bars with center alignment. 

Following is the code that I have used for getting those values inside the bars but couldn't able to get them center aligned. Any help please?

 

scatter x= Months_from_initial_diagnosis_to y= subjid /markerchar=Months_from_initial_diagnosis_to markercharattrs=(family='arial' color=black weight=bold size=8pt);

scatter x=Months_from_Toca_511_administrat y= subjid / markerchar = Months_from_Toca_511_administrat markercharattrs=(family='arial' color=black weight=bold size=8pt) Capture.JPG


 

New Contributor
Posts: 2

Re: Need help! To get the values inside the bars with center alignment

Can you please send me any dummy code for second option that you have suggested. So that I can get better understanding.

 

Thanks,

Pavan

SAS Super FREQ
Posts: 1,265

Re: Need help! To get the values inside the bars with center alignment

VBAR and HBAR also also support SEGLABEL with SAS 9.40M2 release.  This makes it much easier to label each segment of a stacked bar.  http://support.sas.com/kb/55/866.html

Super User
Posts: 22,874

Re: Need help! To get the values inside the bars with center alignment

Can you provide data and code so I can replicate your current graph? 

 

Mocking up the data and graph from scratch is quite a bit of work (that you’ve already done) and I also can’t see your other code which may impact the results. If you can’t provide your data, try using one of the datasets in SASHELP instead. 

 

Also, what version of SAS are you using?

 

Proc product_status;run;
Super User
Posts: 22,874

Re: Need help! To get the values inside the bars with center alignment

Can you provide data and code so I can replicate your current graph? 

 

Mocking up the data and graph from scratch is quite a bit of work (that you’ve already done) and I also can’t see your other code which may impact the results. If you can’t provide your data, try using one of the datasets in SASHELP instead. 

 

Also, what version of SAS are you using?

 

Proc product_status;run;
Ask a Question
Discussion stats
  • 5 replies
  • 100 views
  • 0 likes
  • 3 in conversation