03-27-2018 05:26 PM
I would like to obtain only one graph with the two cumulative distribution function in order to compare them.
However, with this code, SAS generates 2 distinct graphs:
proc univariate data=WORK.CDF;
var AGE HEIGHT;
What do I need to change to have both curves on one single graph in order to compare them?
Thanks a lot in advance for your help
03-28-2018 08:50 AM
03-28-2018 09:17 AM
You must have a too big table to plot all these point in a graph. Try this one .
ods select none; ods output EDFPlot=plot; proc npar1way data=sashelp.class plots=edfplot edf ; class sex; var weight; run; ods select all; proc sgplot data=plot; step x=_x y=_edf/group=_class; run;
03-28-2018 09:33 AM
03-28-2018 11:45 AM
I tried your code but once again, I obtain the same error (my dataset is quite large, you're right):
WARNING: You must enable ODS graphics before requesting plots.
ERROR: The SAS System stopped processing this step because of insufficient memory.
Do you have any other idea?
ODS graphics on;
Proc <any proc with plot statements>
You may want to add ODS Graphics off;
afterwards so that some procs such as Proc freq don't generate plots when not wanted.
Also use the ODS graphics statement to control things like the height and width of the plot area if it is too small by default.
03-28-2018 12:02 PM
03-28-2018 05:12 PM
How many levels does your TRUEPERF variable have? and Performance_adj?
You might try summarizing the data first and telling the procedure how many records are involved especially if you have lots of repear
proc summary data=WORK.QUERY_FOR_FINALDATABASE nway; class TRUEPERF Performance_adj; output out=work.summarized; run; /* which adds _freq_ with the count of combinations of the CLASS variables*/ proc npar1way data=WORK.summarized plots=edfplot edf ; class TRUEPERF; var Performance_adj; freq _freq_; run;
04-04-2018 04:43 PM
I have once again one problem with this procedure that I cannot solve.
My dataset is really simple and not big (2 columns and 100 lines) with this structure
I can plot both on seperate graphs without any problems with the following code:
title 'Cumulative Distribution Function of Breaking Strength';
ods graphics on;
proc univariate data=work.cdf noprint;
cdf ActualReturn BootstrapReturn / overlay;
But when I use the following code to plot both on the same one, nothing appears on the graph even though I have no error in my log.
The other codes proposed do not work neither...
ods graphics on;
proc summary data=WORK.cdf nway;
class ActualReturn BootstrapReturn;
/* which adds _freq_ with the count of combinations of the CLASS variables*/
proc npar1way data=WORK.summarized plots=edfplot edf ;
Do you have any idea of the reason which could explain that? Thanks
03-29-2018 08:22 AM
Maybe you could manually calculate CDF and plot both in a graph .
data Exp; set A nobs=nobs; v = (_N_ - 0.375) / (nobs + 0.25); /* 2 */ q = quantile("Exponential", v, 2); /* 3 */ run;
Here is the blog about it written by @Rick_SAS
03-29-2018 09:45 AM - edited 03-29-2018 09:46 AM
See the article "Comparative histograms in SAS", which shows how to use the CLASS statement in PROC UNIVARIATE to overlay the plots. In this case, you want PROC UNIVARIATE to overlay the CDFPLOT.
The steps are:
1. Convert the data from wide to long.
2. Use PROC UNIVARIATE and the OVERLAY option on the CDFPLOT statement to overlay the CDFPlots
The variables should be on the same (or similar scale).
data Have; set Sashelp.Class; length varName $20; ObsNum = _N_; varName = "Age"; Value = Age; output; /* put VAR1 on this line */ varName = "Height"; Value = Height; output; /* put VAR2 on this line */ run; proc univariate data=Have; class varName; var Value; cdfplot Value/ overlay; run;