I am trying to plot the graph for the below table using the following sas code but ending up in error all the time .
can some one suggest me whats wrong.
finish time : Y axis , dy is axis
work.ETL_Logtables is the below table.
finish_time dy
4:10:31 AM | 25/07/12 | |
4:19:36 AM | 24/07/12 | |
4:11:13 AM | 23/07/12 | |
3:29:20 AM | 22/07/12 | |
5:32:40 AM | 21/07/12 | |
4:48:13 AM | 20/07/12 | |
4:27:11 AM | 19/07/12 | |
4:55:23 AM | 18/07/12 |
data work.ETL_Logtables(keep =dy finish_time) ;
set work.ETL_Logtables_1
work.ETL_Logtables_2
work.ETL_Logtables_3
work.ETL_Logtables_4
work.ETL_Logtables_5
work.ETL_Logtables_6
work.ETL_Logtables_7
work.ETL_Logtables_8;
format start_time finish_time TIMEAMPM11.;
format dy ddmmyy8.;
run;
proc print data =work.ETL_Logtables noobs ;
Title "ETL Logtables timingss";
run;
PROC SORT
DATA=work.ETL_Logtables(KEEP=finish_time dy)
OUT=WORK.SORTTempTableSorted
;
BY dy;
RUN;
SYMBOL1
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_
;
Axis1
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=( "TIME" )
;
Axis2
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=( "DATE" )
;
TITLE;
TITLE1 "Line Plot";
PROC PLOT DATA = WORK.SORTTempTableSorted
;
PLOT dy* finish_time /
VAXIS=AXIS1
HAXIS=AXIS2
FRAME;
RUN; QUIT;
TITLE; FOOTNOTE;
GOPTIONS RESET = SYMBOL;
What error do you get? Can you provide the error portion of your SASLOG?
I don't get any error but the plot is not as expected
Try
PROC GPLOT DATA = WORK.SORTTempTableSorted
PROC PLOT is a character type plot suitable for lineprinters and such. It doesn't support symbol or Axis controls.
Hi Neetu,
I think you wanted the days to be on the X axis and finish time on the Y axis. If not, you need to swap the order in the plot statement.
You can comment out the goptions changing the size of the chart, font, etc.
I had to generate some data. Try this code whether it works for you.
data a;
format finish_time TIMEAMPM11. dy ddmmyy8.;
finish_time='04:55:23't;
do dy='18JUL12'd to '25JUL12'd by 1;
finish_time=finish_time 120*ranuni(0) + 10*ranuni(0);
output;
end;
run;
options nocenter nodate byline;
goptions reset=all ftext="Albany AMT" htext=0.35cm ctext=BLACK fontres=presentation border
vsize=4.2in hsize=7.5in noprompt NOGSFPROMPT;
SYMBOL1
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_;
Axis1
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=( "TIME" );
Axis2
STYLE=1
WIDTH=1
MINOR=NONE
LABEL=( "DATE" );
TITLE;
TITLE2 "Line Plot";
PROC GPLOT DATA = a;
PLOT finish_time*dy / VAXIS=AXIS1 HAXIS=AXIS2 FRAME;
RUN; QUIT;
TITLE2; FOOTNOTE;
GOPTIONS RESET = all;
Each time you generate a plot it is appended to the gseg catalog as Gplot, Gplot1, Gplot2, Gplot3, etc.. You must press page Down to see the last chart. When you want to delete all old plots and start from scratch, submit the following code:
/* delete previously created grsegs before creating new ones */
proc greplay igout=work.gseg nofs;
delete _all_;
run;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.