- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear Community:
My objective is to generate a list of T-scores, by observation, for a simple data set of variable "X" observations (n=13). The issue is that I cannot find a command to create a table of generated T-scores for each individual observation.
For greater clarity, I want to write SAS code to calculate a T score for each observation using the z score and that formula is T = (Z x 10) + 50.
*Build raw data table for 13 provided observations;
DATA HW2;
INPUT X;
DATALINES;
43
42
40
39
38
37
36
24
28
22
18
16
10
;
RUN;
I transformed the X observations into z-scores and generated a new dataset "zHW2" (see below).
*Transform the X scores into z-scores;
PROC STANDARD data=HW2 Mean=0 STD=1 Out=zHW2;
VAR X;
RUN;
Now I would like to compute the T scores and generate a revised dataset labeled "tHW2."
Thank you.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the clarification. As shown in my previous post, you can compute the T scores directly from dataset HW2 without an intermediate step. But it's not too difficult to use zHW2 either:
data tHW2;
set zHW2;
T=10*X+50;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
According to https://stattrek.com/statistics/dictionary.aspx?definition=T_score, there are more than one definition of t-score. Which is the one you intend? If it is the one attributed to psychometrics, just do a OUT= to generate the z-score and calculate t-score from that.
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC TTEST does not produce results for individual observations. It produces hypothesis tests about the mean and the variance.
If you want a "T-score", you need to define it clearly for us, as I agree with @mkeintz, it is not clear what you are asking for. If it is what I am thinking, you could obtain this via data step coding along with the output (mean and standard deviation) from PROC MEANS/PROC SUMMARY.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @mkeintz and Paige...both responses make sense. The statistical procedure fact, which I inadvertently overlooked while immersed in learning codes, is that the t-test doesn't derive T scores by individual observation. Thus, the procedural inability to create a revised output file. My apologies and thank you again for clarifying my understanding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Even though it is not a typical solution, you should mark your last contribution to this topic as the solution. That way, folks looking for unsolved topics won't spend unnecessary time.
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @jrossgilbert,
Have you tried PROC STANDARD or PROC STDIZE? These procedures can compute a variety of scores for individual observations, for example the psychometric t-scores that have been mentioned:
proc standard data=hw2 mean=50 std=10 out=thw2;
run;
proc stdize data=hw2 add=50 mult=10 out=thw2a oprefix sprefix=t_;
var x;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For greater clarity, I want to write SAS code to calculate a T score for each observation using the z score and that formula is
T = (Z x 10) + 50.
I transformed the X observations into z-scores and generated a new dataset "zHW2" (see below).
*Transform the X scores into z-scores;
PROC STANDARD data=HW2 Mean=0 STD=1 Out=zHW2;
VAR X;
RUN;
My last objective is to generate the computed T scores, by observation, in a new data set labeled "tHW2."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the clarification. As shown in my previous post, you can compute the T scores directly from dataset HW2 without an intermediate step. But it's not too difficult to use zHW2 either:
data tHW2;
set zHW2;
T=10*X+50;
run;