BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aj34321
Quartz | Level 8

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
;;;;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
aj34321
Quartz | Level 8

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

7 REPLIES 7
Kurt_Bremser
Super User

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.

PeterClemmensen
Tourmaline | Level 20

What do you want your graph to look like? 🙂

aj34321
Quartz | Level 8

Attached zip file has the expected look.

Kurt_Bremser
Super User

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;
PeterClemmensen
Tourmaline | Level 20

NOT TESTED, but something like this

 

proc sgplot data=DN;
	vbar dd / response=space_used group=mm groupdisplay=cluster;
run;
aj34321
Quartz | Level 8

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

 

This community is awesome...

 

Thanks, Anil

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
  • 7 replies
  • 1146 views
  • 2 likes
  • 3 in conversation