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

I am creating an excel chart but the labels on x-axis are not shown properly. Is it possible to make this better?

Thanks. 

Attaching the code, the source data and the resulting excel chart.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Try taking TYPE=DISCRETE out of the XAXIS statement.

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Many of us will not download Excel (or Microsoft Office) files because they are security threats. Personally, I no longer download ANY files from forum web sites. Please include the data and code and screen capture examples of plots in your message. Provide the data according to these instructions (and not in any other format).

--
Paige Miller
Arju1
Fluorite | Level 6

Thank you.

As directed, the graph generated is: Please notice that on xaxis the labels are compacted so not usable.

 

Arju1_0-1606642878919.png

Sas Code:

 

data work.msudatax;
infile 'd:\sasdata\charts\msudata.csv'
delimiter=','
missover
firstobs=2
DSD
lrecl = 32767
obs=290;
input Date:ddmmyy10. Time:time. FreeMSU TotalMSU;
format Date ddmmyy10. Time time8.7;
run;
data msudatax;
set msudatax;
date_time=dhms(date,0,0,time);
run;
proc Contents data=work.msudatax;
run;

%data2datastep(msudatax, work, work, E:\Sai\make_msu.sas)
ods excel file="E:\SAI\temp.xlsx" options(sheet_name="gugus.xls");
ods excel options (orientation='landscape');
proc print data=work.msudatax (drop=date_time) noobs;
title "MSU Report";
ods excel options(sheet_interval = 'proc' sheet_name = "MSU");
ods graphics / reset width = 7.4in height=5.8in imagemap;
proc sgplot data = work.msudatax ;
needle x=date_time y=FreeMSU;
format date_time datetime14. ;
xaxis type= discrete display=(nolabel) fitpolicy=SPLIT splitchar=':';
run;
ods graphics / reset;
ods excel close;
quit;

----------------------------------------------------------------------------------------------------------------

Datalines as instructed generated with data2datastep macro -file make_msu.sas:

data work.MSUDATAX;
infile datalines dsd truncover;
input Date:DDMMYY10. Time:TIME8.7 FreeMSU:32. TotalMSU:32. date_time:32.;
format Date DDMMYY10. Time TIME8.7;
datalines4;
26/11/2020,7:02:00,101,370,1921993320
26/11/2020,7:07:00,103,370,1921993620
26/11/2020,7:12:00,100,370,1921993920
26/11/2020,7:17:00,103,370,1921994220
26/11/2020,7:22:00,103,370,1921994520
26/11/2020,7:27:00,105,370,1921994820
26/11/2020,7:32:00,106,370,1921995120
26/11/2020,7:37:00,107,370,1921995420
26/11/2020,7:42:00,108,370,1921995720
26/11/2020,7:47:00,110,370,1921996020
26/11/2020,7:52:00,111,370,1921996320
26/11/2020,7:57:00,112,370,1921996620
26/11/2020,8:02:00,112,370,1921996920
26/11/2020,8:07:00,110,370,1921997220
26/11/2020,8:12:00,110,370,1921997520
26/11/2020,8:17:00,110,370,1921997820
26/11/2020,8:22:00,110,370,1921998120
26/11/2020,8:27:00,108,370,1921998420
26/11/2020,8:32:00,107,370,1921998720
26/11/2020,8:37:00,106,370,1921999020
26/11/2020,8:42:00,106,370,1921999320
26/11/2020,8:47:00,104,370,1921999620
26/11/2020,8:52:00,103,370,1921999920
26/11/2020,8:57:00,99,370,1922000220
26/11/2020,9:02:00,97,370,1922000520
26/11/2020,9:07:00,94,370,1922000820
26/11/2020,9:12:00,89,370,1922001120
26/11/2020,9:17:00,87,370,1922001420
26/11/2020,9:22:00,82,370,1922001720
26/11/2020,9:27:00,79,370,1922002020
26/11/2020,9:32:00,77,370,1922002320
26/11/2020,9:37:00,74,370,1922002620
26/11/2020,9:42:00,68,370,1922002920
26/11/2020,9:47:00,66,370,1922003220
26/11/2020,9:52:00,64,370,1922003520
26/11/2020,9:57:00,63,370,1922003820
26/11/2020,10:02:00,62,370,1922004120
26/11/2020,10:07:00,62,370,1922004420
26/11/2020,10:12:00,62,370,1922004720
26/11/2020,10:17:00,62,370,1922005020
26/11/2020,10:22:00,59,370,1922005320
26/11/2020,10:27:00,56,370,1922005620
26/11/2020,10:32:00,52,370,1922005920
26/11/2020,10:37:00,51,370,1922006220
26/11/2020,10:42:00,48,370,1922006520
26/11/2020,10:47:00,44,370,1922006820
26/11/2020,10:52:00,41,370,1922007120
26/11/2020,10:57:00,37,370,1922007420
26/11/2020,11:02:00,35,370,1922007720
26/11/2020,11:07:00,38,370,1922008020
26/11/2020,11:12:00,39,370,1922008320
26/11/2020,11:17:00,37,370,1922008620
26/11/2020,11:22:00,38,370,1922008920
26/11/2020,11:27:00,37,370,1922009220
26/11/2020,11:32:00,36,370,1922009520
26/11/2020,11:37:00,36,370,1922009820
26/11/2020,11:42:00,33,370,1922010120
26/11/2020,11:47:00,31,370,1922010420
26/11/2020,11:52:00,30,370,1922010720
26/11/2020,11:57:00,28,370,1922011020
26/11/2020,12:02:00,25,370,1922011320
26/11/2020,12:07:00,27,370,1922011620
26/11/2020,12:12:00,23,370,1922011920
26/11/2020,12:17:00,18,370,1922012220
26/11/2020,12:22:00,16,370,1922012520
26/11/2020,12:27:00,15,370,1922012820
26/11/2020,12:32:00,13,370,1922013120
26/11/2020,12:37:00,13,370,1922013420
26/11/2020,12:42:00,13,370,1922013720
26/11/2020,12:47:00,11,370,1922014020
26/11/2020,12:52:00,11,370,1922014320
26/11/2020,12:57:00,12,370,1922014620
26/11/2020,13:02:00,12,370,1922014920
26/11/2020,13:07:00,17,370,1922015220
26/11/2020,13:12:00,22,370,1922015520
26/11/2020,13:17:00,24,370,1922015820
26/11/2020,13:22:00,27,370,1922016120
26/11/2020,13:27:00,28,370,1922016420
26/11/2020,13:32:00,30,370,1922016720
26/11/2020,13:37:00,31,370,1922017020
26/11/2020,13:42:00,34,370,1922017320
26/11/2020,13:47:00,36,370,1922017620
26/11/2020,13:52:00,36,370,1922017920
26/11/2020,13:57:00,37,370,1922018220
26/11/2020,14:02:00,38,370,1922018520
26/11/2020,14:07:00,38,370,1922018820
26/11/2020,14:12:00,37,370,1922019120
26/11/2020,14:17:00,36,370,1922019420
26/11/2020,14:22:00,36,370,1922019720
26/11/2020,14:27:00,37,370,1922020020
26/11/2020,14:32:00,40,370,1922020320
26/11/2020,14:37:00,41,370,1922020620
26/11/2020,14:42:00,41,370,1922020920
26/11/2020,14:47:00,43,370,1922021220
26/11/2020,14:52:00,45,370,1922021520
26/11/2020,14:57:00,44,370,1922021820
26/11/2020,15:02:00,46,370,1922022120
26/11/2020,15:07:00,45,370,1922022420
26/11/2020,15:12:00,44,370,1922022720
26/11/2020,15:17:00,43,370,1922023020
26/11/2020,15:22:00,42,370,1922023320
26/11/2020,15:27:00,43,370,1922023620
26/11/2020,15:32:00,44,370,1922023920
26/11/2020,15:37:00,45,370,1922024220
26/11/2020,15:42:00,45,370,1922024520
26/11/2020,15:47:00,46,370,1922024820
26/11/2020,15:52:00,48,370,1922025120
26/11/2020,15:57:00,51,370,1922025420
26/11/2020,16:02:00,52,370,1922025720
26/11/2020,16:07:00,54,370,1922026020
26/11/2020,16:12:00,54,370,1922026320
26/11/2020,16:17:00,57,370,1922026620
26/11/2020,16:22:00,59,370,1922026920
26/11/2020,16:27:00,59,370,1922027220
26/11/2020,16:32:00,61,370,1922027520
26/11/2020,16:37:00,61,370,1922027820
26/11/2020,16:42:00,62,370,1922028120
26/11/2020,16:47:00,63,370,1922028420
26/11/2020,16:52:00,62,370,1922028720
26/11/2020,16:57:00,64,370,1922029020
26/11/2020,17:02:00,66,370,1922029320
26/11/2020,17:07:00,66,370,1922029620
26/11/2020,17:12:00,62,370,1922029920
26/11/2020,17:17:00,62,370,1922030220
26/11/2020,17:22:00,62,370,1922030520
26/11/2020,17:27:00,63,370,1922030820
26/11/2020,17:32:00,62,370,1922031120
26/11/2020,17:37:00,62,370,1922031420
26/11/2020,17:42:00,62,370,1922031720
26/11/2020,17:47:00,61,370,1922032020
26/11/2020,17:52:00,60,370,1922032320
26/11/2020,17:57:00,60,370,1922032620
26/11/2020,18:02:00,63,370,1922032920
26/11/2020,18:07:00,62,370,1922033220
26/11/2020,18:12:00,62,370,1922033520
26/11/2020,18:17:00,64,370,1922033820
26/11/2020,18:22:00,65,370,1922034120
26/11/2020,18:27:00,66,370,1922034420
26/11/2020,18:32:00,67,370,1922034720
26/11/2020,18:37:00,70,370,1922035020
26/11/2020,18:42:00,68,370,1922035320
26/11/2020,18:47:00,67,370,1922035620
26/11/2020,18:52:00,69,370,1922035920
26/11/2020,18:57:00,71,370,1922036220
26/11/2020,19:02:00,74,370,1922036520
26/11/2020,19:07:00,77,370,1922036820
26/11/2020,19:12:00,76,370,1922037120
26/11/2020,19:17:00,79,370,1922037420
26/11/2020,19:22:00,83,370,1922037720
26/11/2020,19:27:00,85,370,1922038020
26/11/2020,19:32:00,89,370,1922038320
26/11/2020,19:37:00,92,370,1922038620
26/11/2020,19:42:00,93,370,1922038920
26/11/2020,19:47:00,95,370,1922039220
26/11/2020,19:52:00,97,370,1922039520
26/11/2020,19:57:00,100,370,1922039820
26/11/2020,20:02:00,104,370,1922040120
26/11/2020,20:07:00,105,370,1922040420
26/11/2020,20:12:00,101,370,1922040720
26/11/2020,20:17:00,99,370,1922041020
26/11/2020,20:22:00,100,370,1922041320
26/11/2020,20:27:00,102,370,1922041620
26/11/2020,20:32:00,104,370,1922041920
26/11/2020,20:37:00,106,370,1922042220
26/11/2020,20:42:00,106,370,1922042520
26/11/2020,20:47:00,106,370,1922042820
26/11/2020,20:52:00,106,370,1922043120
26/11/2020,20:57:00,106,370,1922043420
26/11/2020,21:02:00,108,370,1922043720
26/11/2020,21:07:00,109,370,1922044020
26/11/2020,21:12:00,111,370,1922044320
26/11/2020,21:17:00,113,370,1922044620
26/11/2020,21:22:00,115,370,1922044920
26/11/2020,21:27:00,118,370,1922045220
26/11/2020,21:32:00,123,370,1922045520
26/11/2020,21:37:00,125,370,1922045820
26/11/2020,21:42:00,123,370,1922046120
26/11/2020,21:47:00,123,370,1922046420
26/11/2020,21:52:00,125,370,1922046720
26/11/2020,21:57:00,127,370,1922047020
26/11/2020,22:02:00,129,370,1922047320
26/11/2020,22:07:00,133,370,1922047620
26/11/2020,22:12:00,134,370,1922047920
26/11/2020,22:17:00,136,370,1922048220
26/11/2020,22:22:00,135,370,1922048520
26/11/2020,22:27:00,132,370,1922048820
26/11/2020,22:32:00,134,370,1922049120
26/11/2020,22:37:00,135,370,1922049420
26/11/2020,22:42:00,133,370,1922049720
26/11/2020,22:47:00,133,370,1922050020
26/11/2020,22:52:00,135,370,1922050320
26/11/2020,22:57:00,137,370,1922050620
26/11/2020,23:02:00,138,370,1922050920
26/11/2020,23:07:00,138,370,1922051220
26/11/2020,23:12:00,134,370,1922051520
26/11/2020,23:17:00,131,370,1922051820
26/11/2020,23:22:00,128,370,1922052120
26/11/2020,23:27:00,126,370,1922052420
26/11/2020,23:32:00,126,370,1922052720
26/11/2020,23:37:00,125,370,1922053020
26/11/2020,23:42:00,120,370,1922053320
26/11/2020,23:47:00,117,370,1922053620
26/11/2020,23:52:00,115,370,1922053920
26/11/2020,23:57:00,111,370,1922054220
27/11/2020,0:02:00,106,370,1922054520
27/11/2020,0:07:00,110,370,1922054820
27/11/2020,0:12:00,107,370,1922055120
27/11/2020,0:17:00,108,370,1922055420
27/11/2020,0:22:00,105,370,1922055720
27/11/2020,0:27:00,100,370,1922056020
27/11/2020,0:32:00,96,370,1922056320
27/11/2020,0:37:00,92,370,1922056620
27/11/2020,0:42:00,85,370,1922056920
27/11/2020,0:47:00,79,370,1922057220
27/11/2020,0:52:00,80,370,1922057520
27/11/2020,0:57:00,79,370,1922057820
27/11/2020,1:02:00,76,370,1922058120
27/11/2020,1:07:00,73,370,1922058420
27/11/2020,1:12:00,65,370,1922058720
27/11/2020,1:17:00,56,370,1922059020
27/11/2020,1:22:00,48,370,1922059320
27/11/2020,1:27:00,42,370,1922059620
27/11/2020,1:32:00,38,370,1922059920
27/11/2020,1:37:00,37,370,1922060220
27/11/2020,1:42:00,38,370,1922060520
27/11/2020,1:47:00,39,370,1922060820
27/11/2020,1:52:00,38,370,1922061120
27/11/2020,1:57:00,33,370,1922061420
27/11/2020,2:02:00,30,370,1922061720
27/11/2020,2:07:00,28,370,1922062020
27/11/2020,2:12:00,26,370,1922062320
27/11/2020,2:17:00,22,370,1922062620
27/11/2020,2:22:00,23,370,1922062920
27/11/2020,2:27:00,21,370,1922063220
27/11/2020,2:32:00,15,370,1922063520
27/11/2020,2:37:00,14,370,1922063820
27/11/2020,2:42:00,14,370,1922064120
27/11/2020,2:47:00,10,370,1922064420
27/11/2020,2:52:00,5,370,1922064720
27/11/2020,2:57:00,0,370,1922065020
27/11/2020,3:02:00,-4,370,1922065320
27/11/2020,3:07:00,-3,370,1922065620
27/11/2020,3:12:00,-3,370,1922065920
27/11/2020,3:17:00,-3,370,1922066220
27/11/2020,3:22:00,-6,370,1922066520
27/11/2020,3:27:00,-8,370,1922066820
27/11/2020,3:32:00,-9,370,1922067120
27/11/2020,3:37:00,-8,370,1922067420
27/11/2020,3:42:00,-8,370,1922067720
27/11/2020,3:47:00,-8,370,1922068020
27/11/2020,3:52:00,-9,370,1922068320
27/11/2020,3:57:00,-8,370,1922068620
27/11/2020,4:02:00,-6,370,1922068920
27/11/2020,4:07:00,-2,370,1922069220
27/11/2020,4:12:00,0,370,1922069520
27/11/2020,4:17:00,2,370,1922069820
27/11/2020,4:22:00,7,370,1922070120
27/11/2020,4:27:00,11,370,1922070420
27/11/2020,4:32:00,16,370,1922070720
27/11/2020,4:37:00,21,370,1922071020
27/11/2020,4:42:00,26,370,1922071320
27/11/2020,4:47:00,29,370,1922071620
27/11/2020,4:52:00,28,370,1922071920
27/11/2020,4:57:00,29,370,1922072220
27/11/2020,5:02:00,35,370,1922072520
27/11/2020,5:07:00,42,370,1922072820
27/11/2020,5:12:00,49,370,1922073120
27/11/2020,5:17:00,54,370,1922073420
27/11/2020,5:22:00,61,370,1922073720
27/11/2020,5:27:00,66,370,1922074020
27/11/2020,5:32:00,71,370,1922074320
27/11/2020,5:37:00,71,370,1922074620
27/11/2020,5:42:00,73,370,1922074920
27/11/2020,5:47:00,73,370,1922075220
27/11/2020,5:52:00,73,370,1922075520
27/11/2020,5:57:00,77,370,1922075820
27/11/2020,6:02:00,80,370,1922076120
27/11/2020,6:07:00,83,370,1922076420
27/11/2020,6:12:00,80,370,1922076720
27/11/2020,6:17:00,79,370,1922077020
27/11/2020,6:22:00,81,370,1922077320
27/11/2020,6:27:00,83,370,1922077620
27/11/2020,6:32:00,89,370,1922077920
27/11/2020,6:37:00,90,370,1922078220
27/11/2020,6:42:00,95,370,1922078520
27/11/2020,6:47:00,99,370,1922078820
27/11/2020,6:52:00,102,370,1922079120
27/11/2020,6:57:00,105,370,1922079420
27/11/2020,7:02:00,108,370,1922079720
;;;;

 

 

PaigeMiller
Diamond | Level 26

Try taking TYPE=DISCRETE out of the XAXIS statement.

--
Paige Miller
Arju1
Fluorite | Level 6
Hello PaigeMiller,
Thank you so much. It is working.
Is it possible to change attributes of negative msu needles red?
with warm regards
Arju
PaigeMiller
Diamond | Level 26

You might be able to do this with what SAS calls Attribute Maps, but I have never done this for a Needle Plot. So I leave it up to you to give it a try.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1883 views
  • 0 likes
  • 2 in conversation