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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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;

View solution in original post

7 REPLIES 7
mkeintz
PROC Star

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

--------------------------
PaigeMiller
Diamond | Level 26

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
jrossgilbert
Calcite | Level 5

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.

mkeintz
PROC Star

@jrossgilbert

 

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

--------------------------
FreelanceReinh
Jade | Level 19

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;
jrossgilbert
Calcite | Level 5

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."

FreelanceReinh
Jade | Level 19

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;

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 4543 views
  • 0 likes
  • 4 in conversation