Data visualization with SAS programming

Graph comparison of current versus previous month for each day.

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 76
Accepted Solution

Graph comparison of current versus previous month for each day.

[ Edited ]

Hi All,

 

I'm facing difficulty in generating a graph thru sas code. Attached is the sample graph output expected.

 

Request if some can help me on the code that produces this output. 

 

Thanks for your help.

 

Rgds, Anil

 

Data step code:

data TEMP.DN;
  infile datalines dsd truncover;
  input log_date:DATE9. space_used:COMMA4. yy:32. mm:32. dd:32.;
datalines4;
01JUL2017,21,2017,7,1
02JUL2017,22,2017,7,2
03JUL2017,22,2017,7,3
04JUL2017,22,2017,7,4
05JUL2017,22,2017,7,5
06JUL2017,22,2017,7,6
07JUL2017,22,2017,7,7
08JUL2017,22,2017,7,8
09JUL2017,22,2017,7,9
10JUL2017,22,2017,7,10
11JUL2017,22,2017,7,11
12JUL2017,22,2017,7,12
13JUL2017,23,2017,7,13
14JUL2017,23,2017,7,14
15JUL2017,23,2017,7,15
16JUL2017,24,2017,7,16
17JUL2017,24,2017,7,17
18JUL2017,24,2017,7,18
19JUL2017,24,2017,7,19
20JUL2017,25,2017,7,20
21JUL2017,25,2017,7,21
22JUL2017,25,2017,7,22
23JUL2017,25,2017,7,23
24JUL2017,25,2017,7,24
25JUL2017,25,2017,7,25
26JUL2017,25,2017,7,26
27JUL2017,26,2017,7,27
28JUL2017,26,2017,7,28
29JUL2017,26,2017,7,29
30JUL2017,26,2017,7,30
31JUL2017,26,2017,7,31
01AUG2017,27,2017,8,1
02AUG2017,28,2017,8,2
03AUG2017,28,2017,8,3
04AUG2017,28,2017,8,4
05AUG2017,28,2017,8,5
06AUG2017,28,2017,8,6
07AUG2017,28,2017,8,7
08AUG2017,28,2017,8,8
;;;;

 

 

Attachment

Accepted Solutions
Solution
‎08-17-2017 03:21 AM
Frequent Contributor
Posts: 76

Re: Graph comparison of current versus previous month for each day.

Thank you guys.. All of your codes in portions helped me build my graph.

 

This community is awesome...

 

Thanks, Anil

View solution in original post


All Replies
Super User
Posts: 7,824

Re: Graph comparison of current versus previous month for each day.

[ Edited ]

Please use the macro provided in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to convert your dataset to a data step and post that in a code box ({i} or "little running man" icon).

Excel files cannot convey the structure of a dataset, can pose a security risk, and are therefore blocked from downloading at many corporate sites (which give employment to the majority of posters here).

 

For the wanted result, attach a screenshot.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 761

Re: Graph comparison of current versus previous month for each day.

What do you want your graph to look like? Smiley Happy

Frequent Contributor
Posts: 76

Re: Graph comparison of current versus previous month for each day.

Attached zip file has the expected look.

Attachment
Super User
Posts: 7,824

Re: Graph comparison of current versus previous month for each day.

This is the code I got from EG with point-and-click (I'm no GRAPH expert):

Axis1
  STYLE=1
  WIDTH=1
  MINOR=NONE
;
Axis2
  STYLE=1
  WIDTH=1
  VALUE=NONE
;

PROC GCHART DATA=WORK.DN
;
  VBAR 
   mm
 /
  SUMVAR=space_used
  GROUP=dd
  CLIPREF
FRAME  TYPE=SUM
  NOLEGEND
  COUTLINE=BLACK
  RAXIS=AXIS1
  MAXIS=AXIS2
PATTERNID=MIDPOINT
;
RUN;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 761

Re: Graph comparison of current versus previous month for each day.

NOT TESTED, but something like this

 

proc sgplot data=DN;
	vbar dd / response=space_used group=mm groupdisplay=cluster;
run;
PROC Star
Posts: 761

Re: Graph comparison of current versus previous month for each day.

Consult the PROC SGPLOT documentation to adjust the axes and so on to your liking

 

http://support.sas.com/documentation/cdl/en/grstatproc/62603/HTML/default/viewer.htm#sgplot-stmt.htm

Solution
‎08-17-2017 03:21 AM
Frequent Contributor
Posts: 76

Re: Graph comparison of current versus previous month for each day.

Thank you guys.. All of your codes in portions helped me build my graph.

 

This community is awesome...

 

Thanks, Anil

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 199 views
  • 2 likes
  • 3 in conversation