BookmarkSubscribeRSS Feed
viollete
Calcite | Level 5

Hello,

I want to make a very simple graph, i have data where one variable is the month (character, January-June) and i want to make a bar chart of frequency of month. I use the code given below. But in the graph month are sorted in alphabetical way (starting April). What should i add or what should i do, that in graph month would be from January to June?

PATTERN1 COLOR=CX3C2CCF;

  PATTERN2 COLOR = _STYLE_;

  PATTERN3 COLOR = _STYLE_;

  PATTERN4 COLOR = _STYLE_;

  PATTERN5 COLOR = _STYLE_;

  PATTERN6 COLOR = _STYLE_;

  PATTERN7 COLOR = _STYLE_;

  PATTERN8 COLOR = _STYLE_;

  PATTERN9 COLOR = _STYLE_;

  PATTERN10 COLOR = _STYLE_;

  PATTERN11 COLOR = _STYLE_;

  PATTERN12 COLOR = _STYLE_;

Axis1

  STYLE=1

  WIDTH=1

  MAJOR=NONE

  MINOR=NONE;

Axis2

  STYLE=1

  WIDTH=1;

TITLE;

FOOTNOTE;

PROC GCHART DATA=parto

;

  VBAR3D

  Month

/

  SHAPE=BLOCK

  SPACE=7

FRAME TYPE=FREQ

FREQ

  COUTLINE=BLACK

  RAXIS=AXIS1

  MAXIS=AXIS2

  LREF=1

  CREF=BLACK

  AUTOREF

;

RUN; QUIT;

1 REPLY 1
SteveNZ
Obsidian | Level 7

You could change your character dates to actual SAS dates and then format them using the MONNAME. format.

52data _null_ ;
53format date monname. ;
54date = '01jan2013'd ;
55put date ;
56run ;

January

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
  • 1 reply
  • 373 views
  • 0 likes
  • 2 in conversation