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

What I try to do are:

(1) add upper and lower confidence limit curves for data1 (say at 95% confidence level); and

(2) use the same x axis for the merged CDF graph (the graph below has two x axis overlay).

 

I have tried several options like CIPCTLDF or CIPCTLNORMAL for confidence limit curves, no progress. Too late at night, brain doesn't function well &_& Thank you for your kindly help.

 

proc greplay nofs igout=gseg; delete _all_; run;

goptions nodisplay;
      ods graphics off;
      proc univariate data=data1 noprint ;
        cdf nr5m / normal(color=red)
                   name='FIGURE1'
                   height=2;
        inset normal(mu sigma) / header='NR5M' position=nw  height=2 ;
      run;
      quit;

      proc univariate data=data2 noprint;
        cdf nr1000m / normal(color=blue)
                      name='FIGURE2'                
                      height=2;
        inset normal(mu sigma) / header='NR1000M' position = (0.65, 85)  refpoint = tl  height=2;
      run;
      quit;

	  title 'CDF of Data1 and Data2';
      goptions display;
      proc greplay igout=work.gseg tc=sashelp.templt template=whole nofs;
        treplay 1:FIGURE1 1:FIGURE2;
      run;

      ods graphics on;

CDF 1and2.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
How about this one :



ods select none;
ods output  CDFPlot=cdfplot Quantiles=quantiles;
proc univariate data=sashelp.class  CIPCTLNORMAL(type=twosided alpha=0.05);
 var weight height;
 cdf weight height/normal ;
run;
ods select all;
data quantiles;
 set quantiles;
 percent=input(scan(quantile,1,'%'),best.);
run;

data have;
 set quantiles cdfplot;
run;

proc sgplot data=have noautolegend;
band y=percent lower=lclnormal upper=uclnormal/group=varname transparency=0.6;
step x=ecdfx y=ecdfy/group=varname;
series x=cdfx y=cdfy/group=varname name='x';
keylegend 'x' / position=topleft location=inside across=1;
xaxis label=' ';
run;

View solution in original post

6 REPLIES 6
Ksharp
Super User
How about this one :



ods select none;
ods output  CDFPlot=cdfplot Quantiles=quantiles;
proc univariate data=sashelp.class  CIPCTLNORMAL(type=twosided alpha=0.05);
 var weight height;
 cdf weight height/normal ;
run;
ods select all;
data quantiles;
 set quantiles;
 percent=input(scan(quantile,1,'%'),best.);
run;

data have;
 set quantiles cdfplot;
run;

proc sgplot data=have noautolegend;
band y=percent lower=lclnormal upper=uclnormal/group=varname transparency=0.6;
step x=ecdfx y=ecdfy/group=varname;
series x=cdfx y=cdfy/group=varname name='x';
keylegend 'x' / position=topleft location=inside across=1;
xaxis label=' ';
run;

Rick_SAS
SAS Super FREQ

To add to KSharp's suggestion, you can also use the OUTPUT statement and the PCTLPTS= option to obtain the CIs on a denser set of quantiles. See the article "Compute confidence intervals for percentiles in SAS," which also shows how to handle the case of non-normal data.

Jonate_H
Quartz | Level 8

Thank you Ksharp and Rick as always!

Jonate_H
Quartz | Level 8

One more question.

 

In my dataset there are two variables, one variable is for actual data and the other one for simulated. 

Is there any option to add bands only to simulated data's CDF curve? or, can I set band color as transparent for actual data (so that its bands will be unvisible)?

 

For example, can I hide the bands for weight, and only keep bands for hight? I've tried several options, and haven't figure out yet.

Ksharp
Super User
OK. Call missing of them if you don't want.

data have;
 set quantiles cdfplot;
run;
--------->
data have;
 set quantiles cdfplot;
 if VarName='Height' then call missing(lclnormal,uclnormal);
run;


Jonate_H
Quartz | Level 8

That's pretty neat, thank you Ksharp!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 2132 views
  • 6 likes
  • 3 in conversation