Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- defining pvalue in ttest

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 11-30-2019 04:11 AM
(764 views)

Dear Experts,

I have a dataset containing 2 columns - Weight, Follow_weight

I need to find the pval value using ttest for those variables.

Weight column contains 120 values in each row, F_wt column contains only 78 rows

Just for a sample, I share the data (have) here.

```
data have;
input Wt F_wt;
cards;
56.8 59.2
75.2 71.3
88.0 85.1
76.5 76.2
101
26.5
```

Does the below method will return correct pval?

```
ods select none;
ods output ttests=ttest
statistics=tstats;
proc ttest data=have;
paired wt*f_wt;
run;
```

Don't use the above dataset for analysis, It's just for a visual.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If the Weight column contains 120 values in each row and F_wt column contains only 78 rows, I assume that their are missing values for F_wt.

In this case, if you want to perform a Paired Sample Means t-test, the syntax of your t-test is correct. The test will take into account only pairs (so it will exclude rows with missing values) : it will calculate the difference between each pair of Wt and F-wt and then perform the test (-> p_value)

In your example : 6 rows, but only 4 pairs as 2 values are missing.

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If the Weight column contains 120 values in each row and F_wt column contains only 78 rows, I assume that their are missing values for F_wt.

In this case, if you want to perform a Paired Sample Means t-test, the syntax of your t-test is correct. The test will take into account only pairs (so it will exclude rows with missing values) : it will calculate the difference between each pair of Wt and F-wt and then perform the test (-> p_value)

In your example : 6 rows, but only 4 pairs as 2 values are missing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Sathish_jammy wrote:

Dear Experts,

I have a dataset containing 2 columns - Weight, Follow_weight

I need to find the pval value using ttest for those variables.

Weight column contains 120 values in each row, F_wt column contains only 78 rows

Just for a sample, I share the data (have) here.

`data have; input Wt F_wt; cards; 56.8 59.2 75.2 71.3 88.0 85.1 76.5 76.2 101 26.5`

Does the below method will return correct pval?

`ods select none; ods output ttests=ttest statistics=tstats; proc ttest data=have; paired wt*f_wt; run;`

Don't use the above dataset for analysis, It's just for a visual.

For your example data likely not. The way your data step for the example data is set the value 26.5 is paired with 101. Is that intentional? If not then you may have intended the data step to be:

data have; infile datalines truncover; input Wt F_wt; cards; 56.8 59.2 75.2 71.3 88.0 85.1 76.5 76.2 101 26.5 ;

Which results in values of WT with missing values for F_wt.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.