Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
KB131619
Calcite | Level 5

Hello,

 

I feel like I am missing a small thing probably.  But, I have been doing Proc T tests for a set of data.  But can anyone help me set up the top portion if I do not have a set of data but instead i am given the sample size, mean and variance.   Is anyone able to help me figure out what I need do to in place of the data lines and or cards?

6 REPLIES 6
PaigeMiller
Diamond | Level 26

So someone tells you the N (sample size), mean and variance, and you want to test if the mean is zero??? Is this a one-sample test or a two-sample test? You don't tell us.

 

If so, then you can do this with a calculator, the formula is here: https://en.wikipedia.org/wiki/Student%27s_t-test#One-sample_t-test. I don't think you can do this in PROC TTEST.

 

Or you can program that formula into a SAS data step, and also use the SAS function CDF('T', t, df [, nc]) to replace looking up the probability in a statistical table.

 

--
Paige Miller
KB131619
Calcite | Level 5
No there is no 0.
PaigeMiller
Diamond | Level 26

@KB131619 wrote:
No there is no 0.

I'm afraid this doesn't really explain anything. Are you doing one-sample or two-sample t-tests? If you don't want to compare to zero, what do you want to compare to?

--
Paige Miller
quickbluefish
Barite | Level 11

Well, you could simulate some data based on your parameters and then run TTEST on that -- just showing PROC MEANS here to demonstrate that we have two groups with the mean and standard deviation that we expect.  If you have unequal variances (which the below assumes), then be sure to select the correct options in PROC TTEST.

%let SAMPLESIZE_A=1000;
%let MEAN_A=40;
%let VARIANCE_A=16;

%let SAMPLESIZE_B=1500;
%let MEAN_B=35;
%let VARIANCE_B=25;

data sim;
group='A';
do i=1 to &SAMPLESIZE_A;
	x=&MEAN_A+rand('normal')*sqrt(&VARIANCE_A);
	output;
end;
group='B';
do i=1 to &SAMPLESIZE_B;
	x=&MEAN_B+rand('normal')*sqrt(&VARIANCE_B);
	output;
end;
run;

proc means data=sim mean std;
class group;
var x;
run;
Ksharp
Super User

Documentation is always your good friend . Check its example.

Ksharp_0-1740104337398.png

Ksharp_1-1740104354893.png

Ksharp_2-1740104387321.png

 

 

Rick_SAS
SAS Super FREQ

Yes, you can run PROC TTEST when you have only the summary statistics and not the raw data. See 

"Summary statistics and t tests in SAS"

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1236 views
  • 11 likes
  • 5 in conversation