Programming the statistical procedures from SAS

ttest for groups

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

ttest for groups

I have a proc means results like this 

 

Group1

Group2

Xmean

Xstd

N

Ymean

Ystd

Yn

X/Y

X-y

A

0

0.68

1.96

101

0.70

1.89

112

0.48

-0.02

B

0

0.62

1.99

202

0.58

1.87

175

0.54

0.04

C

0

0.56

2.15

101

0.52

1.92

154

0.54

0.04

D

0

0.56

2.53

147

0.62

2.66

1146

0.45

-0.06

A

0

0.62

2.03

202

0.62

1.97

122

0.50

0.00

B

0

0.59

1.97

223

0.61

2.03

4631

0.48

-0.02

C

0

0.55

2.12

202

0.50

2.18

202

0.55

0.05

D

0

0.73

2.29

202

0.64

2.25

101

0.57

0.09

A

0

0.62

2.20

255

0.66

2.25

1144

0.47

-0.04

B

0

0.66

2.44

202

0.59

2.43

101

0.56

0.07

C

0

0.71

2.64

202

0.67

2.63

635

0.53

0.04

D

0

0.68

2.75

202

0.57

2.76

101

0.60

0.11

A

1

0.62

1.66

80

0.57

1.67

77

0.54

0.05

B

1

0.58

1.64

80

0.56

1.64

79

0.51

0.02

C

1

0.54

1.69

80

0.50

1.67

77

0.54

0.04

D

1

0.55

2.28

80

0.48

2.28

77

0.58

0.08

A

1

0.57

1.67

80

0.56

1.68

78

0.51

0.01

B

1

0.58

1.61

80

0.62

1.99

101

0.47

-0.03

C

1

0.53

1.71

80

0.34

1.57

26

0.79

0.19

D

1

0.57

1.90

80

0.47

1.92

74

0.61

0.11

A

1

0.57

1.93

80

0.47

1.96

74

0.60

0.10

B

1

0.57

2.03

80

0.56

2.06

78

0.51

0.01

C

1

0.62

2.15

80

0.51

2.19

73

0.61

0.11

D

1

0.60

2.23

80

0.39

2.17

30

0.77

0.21

and need to run the ttset for group 2, something like this

 

Group2

Xm (xmean)

Ym (ymean)

xm/ym

xm-ym

0

0.63

0.61

0.52

0.03

1

0.58

1.88

0.59

0.07

group2(0)-group2(1)

0.06

-1.27

-0.06

-0.05

t-value

?

?

?

?

however I am not sure how to use proc ttest for this case. in this example, 0.63 is the  x variable mean for group2=0 (x itself is mean from each group0*group1  classification (first table).

I calculated the dufferences for mean, ratio and the difference adnd need to calculate the t-stats. I am not sure if covariances are zero.

 

I want to go from first table to the second table in SAS (any version). I would appreciate your comments.

 

Thanks


Accepted Solutions
Solution
‎07-12-2017 09:38 AM
SAS Super FREQ
Posts: 3,475

Re: ttest for groups

You can use the TEST=RATIO option on the PROC TTEST statement to test for the ratio of means. See the doc for PROC TTEST. You'll probably want to graph the data to determine if DIST=NORMAL or DIST=LOGNORMAL is appropriate.

View solution in original post


All Replies
Super User
Posts: 17,775

Re: ttest for groups

1. Do you by chance have the raw data?

2. Is this a meta analysis? 

New Contributor
Posts: 4

Re: ttest for groups

Yes, I have the raw data, which are panel data and I created the first table using a proc means.
No it is not a meta study. I am comparing two groups asset returns.
New Contributor
Posts: 4

Re: ttest for groups

of course, there is a class option for the ttest procedure but I have a mean of raios with different n and I am not sure if mean ratio  has normal/tstudent distribution. So I need to consider different sample sizze for which I have a ratio, for example 101 ons for ratio .48 and also may need taylor linearization for the ratio distribution. 

Solution
‎07-12-2017 09:38 AM
SAS Super FREQ
Posts: 3,475

Re: ttest for groups

You can use the TEST=RATIO option on the PROC TTEST statement to test for the ratio of means. See the doc for PROC TTEST. You'll probably want to graph the data to determine if DIST=NORMAL or DIST=LOGNORMAL is appropriate.

Super User
Posts: 17,775

Re: ttest for groups

If you have the raw data you may want to analyze the raw data rather than the summary statistics.

 

I suspect that may be a more complex model than a t-test, most likely a mixed model

SAS Employee
Posts: 11

Re: ttest for groups

I would follow Rick's suggestion above, using the raw data with PROC TTEST.  

 

If you have other factors in the data or if your groups really are a factor in a model, then using PROC GLM or PROC MIXED may be appropriate.  

New Contributor
Posts: 4

Re: ttest for groups

What about using log-normal distibution with TEST=RATIO in proc ttest? Do you think it is suitable?

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 140 views
  • 4 likes
  • 4 in conversation