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

I want to know a proc by which z test can be conducted as like for t-test there is a proc ttest.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@lady8506 please start your own question.

 

There isn't much Z test information out there because it's rarely used and rarely applicable. For large N the T-Test will approximate the Z-Test quite closely, almost exactly as you get to large Ns. 

 

If you check the T-Test documentation, the first example shows how to perform a t-test with summary statistics. 

 

Another reply from Rick:

The only z test that I can think of that is used in practice is the test for difference between two proportions. You can conduct that test by using PROC FREQ, as shown by Usage Note 22561.

View solution in original post

8 REPLIES 8
Arun_shSAS
Fluorite | Level 6

Hi Reeza, 

 

Sorry, my question didnt give much clarification. I want to know a proc by which z test can be conducted as like for t-test there is a proc ttest.

Reeza
Super User

I don't think there is one. A z test is only appropriate if you have the full population, which is rare, and at large numbers they'll give the same results anyways. 

 

What kind of Z test do you need? There are some examples of people having hardcoded data steps to do this, but it's rare for a reason.

Rick_SAS
SAS Super FREQ

What are the data and what question are you trying to answer?

 

The only z test that I can think of that is used in practice is the test for difference between two proportions. You can conduct that test by using PROC FREQ, as shown by Usage Note 22561.

PaigeMiller
Diamond | Level 26

@Arun_shSAS wrote:

Hi Reeza, 

 

Sorry, my question didnt give much clarification. I want to know a proc by which z test can be conducted as like for t-test there is a proc ttest.


This really doesn't give us useful information. Can you state what hypothesis you are trying to test, and what your data is, and what distribution you have, and things like that? Just start from scratch, and describe the ENTIRE WHOLE COMPLETE problem for us, leaving nothing out, and do not be stingy with words.

--
Paige Miller
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

If you are trying to compare two means with a z test, you can just trick PROC MIXED into doing this, because a t distribution with infinite df is equivalent to a standard normal distribution. If you have data in long form, with a separate record for the treatment and control (as an example, with a variable called treat for identifying treatment (say 0 for control and 1 for treated), you can use:

proc mixed data=...;

class treat;

model y = treat / ddf = 10000 solution;

run;

 

The Solution output gives the "t statistic", but with df=10000, this is really giving you a z test for the mean difference. Of course, this would be very misleading if you have a small number of observations.

 

Rick_SAS
SAS Super FREQ

Please provide details about what problem you are trying to solve. Do you want

1. A z-test for a one-sample mean for which the population mean and variance are known? (textbook problem)

2. A z-test for comparing the means of two samples for which the population variances are known? (textbook problem)

3. A z-test for the difference of proportions?

4. Something else?

 

lady8506
Quartz | Level 8

Hi, Rick,

 

I have also been trying to find documentation on what procedure to run and what attributes to specify for a one-sample z-test. I was wondering if you could help me figure this out?

 

In my dataset, I have data on 58 people, so the standard deviation, mean and distributions are all known. My data is being compared to the U.S. population norm data collected by a survey company. The only thing that is known from their data is the mean and the standard deviation. So I would like to run a one-sample z-test that compares my mean against theirs with the null hypothesis being: "There is no difference in the means between the two populations". A couple of questions:

 

1. The standard deviation needs to be known for which population, or is it both of them?

2. Why is it so difficult to find a tutorial on this via Google? Any time I find anything regarding doing a z-test, I mostly get t-test instructions instead, or, if I do get a z-test instructions, I get tutorials on knowing the variance and not specifically how to do a z-test in SAS, but by-hand calculations instead. And if I do get an SAS tutorial, there is nothing said in any example about inputting anything about the variance for PROC FREQ (I'm assuming this is the z-test). So, I gather from your questions, that you have to know the variance for a z-test, then why isn't it talked about in tutorials or specified in PROC FREQ examples, like h0 is? 

 

Confused!!!

Reeza
Super User

@lady8506 please start your own question.

 

There isn't much Z test information out there because it's rarely used and rarely applicable. For large N the T-Test will approximate the Z-Test quite closely, almost exactly as you get to large Ns. 

 

If you check the T-Test documentation, the first example shows how to perform a t-test with summary statistics. 

 

Another reply from Rick:

The only z test that I can think of that is used in practice is the test for difference between two proportions. You can conduct that test by using PROC FREQ, as shown by Usage Note 22561.

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!

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
  • 8 replies
  • 13318 views
  • 1 like
  • 6 in conversation