My data set is really simple, just one colum with a ratio and another colum with a categorical var, I need to calculate the standard deviation for each class as well as the confidence interval.
Is there a built in function in SAS (proc SQL) to calculate the conficende interval of the standar deviation???
something like the excel function confidence() does?
thanks!
Not Proc SQl but PROC Univariate will give you the confidence intervals of mean, standard deviations and variance. The details are available in SAS support documents:
https://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_univariate_sect064.htm
The following statements produce confidence limits for the mean, standard deviation, and variance of the population of heights:
ods select BasicIntervals;
proc univariate data=Heights cibasic;
var Height;
run;
Related
I'm trying to report estimates of proportions of subjects of a stratified random sample
I've tried every website I can find for SAS proc surveymeans, and I don't understand what I'm doing wrong.
data b;
set Data;
keep id texting section;
run;
proc surveyselect data=b out=samp_b method=srs n=(15,12,10,8)
seed=123;
strata section;
run;
proc surveymeans data=samp_b;
strata section;
weight SamplingWeight;
var texting;
run;
I should get confidence intervals for the strata, but they are not showing up. Also I need confidence intervals for the proportions!
I don't know what version of SAS/STAT you are using, but per SAS/STAT 9.2 Proc Surveymeans documentation pages, you can do one or both of the following:
1) Add the relevant statistics keywords to the proc surveymeans statement
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_sect007.htm
In the PROC SURVEYMEANS statement, you also can use statistic-keywords to specify statistics for the procedure to compute. Available statistics include the population mean and population total, together with their variance estimates and confidence limits. You can also request data set summary information and sample design information.
The available statistics keywords are listed and described on these pages:
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_a0000000238.htm
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_sect007.htm#statug.surveymeans.smeanskeys
So, to print the 95% two-sided confidence interval for the mean, you would add CLM to the end of your Proc Surveymeans statement.
2) Save the Statistics table with confidence intervals to a separate SAS dataset with an additional ods output Statistics=MyStat; statement, per these instructions.
I am using SAS for producing ROC curves. But the "PROC LOGISTIC" does not give me the confidence-interval for sensitivity and specificity.
Does any one know if there is an option in order to produce the lower and upper band for sensitivity and specificity ?
If it is not the case, does anyone know another method ?
Thk an lot,
when I use basic stats, I use proc freq for associations.
proc freq data=tempds noprint;
tables variable1*std_variable2 / chisq measures;
output out=outds pchi n OR FISHER;
run;
The output dataset "outds" now contains RROR(OR), L_RROR(Lower CI), U_RROR(Upper CI). Is this what you are looking for?
If proc logistic doesn't directly support this, you could try bootstrapping - produce many ROC plots for random samples of your data (e.g. using proc surveyselect) and then calculate the p5 and p95 points for each x and y value in the plot using proc summary. This should give a good approximation provided that you use a large enough number of samples.
Since I need to standardizing (subtracting the mean and dividing by standard deviation) my dataset, I should mean and standard deviation of price and volume of each stock in each date. Particularly, my dataset includes different stock and date as shown in the following pic.
Hence, I used the following code to output mean and standard deviation.
proc summary data=HAVE nway;
class _ric date;
var price volume;
output out=WANT(drop=_:) mean= std=/autoname;
run;
However, my output table only has date, mean, and standard deviation. I don't why the RIC isn't included in the output table. How could I solve this problem? Thanks
The dataset doesn't have the variable _RIC because you told it to drop all variables whose name starts with _. Just be more specific in the variables you drop.
out=WANT(drop=_type_ _freq_)
I want to put all confidence interval plot in one plot for all strata variable after logistic regression. For example, my SAS code is:
proc logistic data=data1;
model y = x;
strata cv1;
output out=out1 unknown1=x_beta1 unknown2=lowerbound unknown3=upperbound unknown4=strata_variable;
run;
I do not know what variable names(unknown1 unknown2 unknown3) I can use in the output statement. As in the sas support page, it said "If a STRATA statement is specified, only the PREDICTED=, DFBETAS=, and H= options are available",here is the link.
My plot statement will be:
proc sgplot data=out1;
scatter y=strata_variable x=x_beta1 / xerrorlower=lowerbound xerrorupper=upperbound
markerattrs=(symbol=circlefilled size=9);
run;
The first plot in this page shows exactly what I want. Sorry I cannot insert any plot as my reputation is not high enough.
I find an another way to finish this. I wrote a macro do loop to get every strata data. And then added
ods output OddsRatios=odds_temp;
to get the estimation and confidence interval and merger all the strata together to make the plot I need.
is there a way to detect an outlier from proc means while calculating min max Q1 and Q3?
the box plot procedure is not working on my SAS and I am trying to perform a boxplt in excel with the values from SAS.
Assuming you have a specific definition for what an outlier is, PROC UNIVARIATE can calculate the value that appears at that percentile using the PCTLPTS keyword on the OUTPUT statement. It also will identify extreme observations individually, so you can see the top few observations (if you have few enough observations that the number of extremes is likely to be <= 5).
The paper A SAS Application to Identify and Evaluate Outliers goes over a few of the ways you can look at outliers, including box plots and PROC UNIVARIATE, and includes some regression-based approaches as well.
If you want a 'standard boxplot' use the outbox= option in SAS to create the standard data set used for a box plot.
proc boxplot data=sashelp.class;
plot age*sex / outbox = xyz;
run;