Goodevening,
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;
cdfplot ;
run;
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 🙂
Check KS Test.
proc npar1way data=sashelp.class plots=edfplot edf ;
class sex;
var weight;
run;
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;
@Max05 wrote:
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?
Thanks!!
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.
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;
Goodevening,
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
ActualReturn BootstrapReturn
-2.18 -2.08
-2.06 -2.01
... ...
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;
run;
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;
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 ActualReturn;
var BootstrapReturn;
freq _freq_;
run;
Do you have any idea of the reason which could explain that? Thanks 🙂
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
https://blogs.sas.com/content/iml/2011/10/28/modeling-the-distribution-of-data-create-a-qq-plot.html
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;
Thank you veru much for your helpful answers!! 🙂
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.