<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a 0-100 score with 3 items  - Linear transformation? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716371#M221381</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321469"&gt;@Kim2009&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The calculation in SAS is relatively easy because the MEAN function excludes missing values by default, hence combines steps 1 - 3. So we only need to replace values 9 and 99 by missing values before calling the MEAN function. This is demonstrated below using artificial test data created in a preliminary DATA step because I don't have Excel on my SAS workstation. (Many experts here won't even download Excel files due to security concerns.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data have;
call streaminit(27182818);
length ID 8;
array v[6]  _temporary_ (1:4 9 99);
array p1[6] _temporary_ (.1 .2 .4 3*.1);
array p2[6] _temporary_ (2*.05 3*.25 .15);
array p3[6] _temporary_ (2*.15 2*.3 2*.05);
array score[*] CTIOne CTITwo CTIThree;
do ID=1 to 500;
  score[1]=v[rand('table', of p1[*])];
  score[2]=v[rand('table', of p2[*])];
  score[3]=v[rand('table', of p3[*])];
  output;
end;
run;

/* Create scaled mean score CTI3_NewScale (between 0 and 100) */

data want(drop=_:);
set have;
array score[*] CTIOne CTITwo CTIThree;
array _nmCTI[3];
do _i=1 to dim(score);
  if score[_i] in (1:4) then _nmCTI[_i]=score[_i];
  else if score[_i] in (9, 99) then _nmCTI[_i]=.m;
  else put 'WAR' 'NING: Invalid score for ID ' id  +(-1) ': ' score[_i]=;
end;
if n(of _nmCTI[*]) then CTI3_NewScale=(mean(of _nmCTI[*])-1)*100/3;
else CTI3_NewScale=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Feb 2021 11:07:39 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-02-03T11:07:39Z</dc:date>
    <item>
      <title>Creating a 0-100 score with 3 items  - Linear transformation?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716289#M221347</link>
      <description>&lt;P&gt;Greetings -&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to figure out how to transform 3 variables so that the range is from 0-100.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the 3 variables that can also be found in the attached xlsx file. The sum of the 3 variables range between 3 (min) and 12 (max).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CTIOne&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;CTITwo&lt;/TD&gt;&lt;TD&gt;CITThree&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Responses for each of the variables were scored as&lt;/P&gt;&lt;P&gt;Strongly Disagree =1; Disagree =2; Agree =3; Strongly Agree =4; 9=Don't know; 99=Missing&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found an SPSS resource on this topic online but didn't find any SAS documentation that was straightforward. Here are the steps outlined in the SPSS document.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Calculate the sum of responses across the 3 variables (excluding values of 9 and 99) - New variable name = CTI3Sum&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Count the number of questions answered, i.e. 1-3 (excluding values of 9 and 99) - New variable name&amp;nbsp; = CTI3Ct&lt;/P&gt;&lt;P&gt;3. Calculate the mean response - New variable name = CTI3Mean which is calculated by CTI3Sum/CTI3Ct&lt;/P&gt;&lt;P&gt;4. Use linear&amp;nbsp; transformation to convert to 0-100 score&amp;nbsp; - New variable name = CTI3_NewScale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance on how to perform these steps in SAS would be greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Kim&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 02:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716289#M221347</guid>
      <dc:creator>Kim2009</dc:creator>
      <dc:date>2021-02-03T02:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 0-100 score with 3 items  - Linear transformation?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716371#M221381</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321469"&gt;@Kim2009&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The calculation in SAS is relatively easy because the MEAN function excludes missing values by default, hence combines steps 1 - 3. So we only need to replace values 9 and 99 by missing values before calling the MEAN function. This is demonstrated below using artificial test data created in a preliminary DATA step because I don't have Excel on my SAS workstation. (Many experts here won't even download Excel files due to security concerns.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create test data for demonstration */

data have;
call streaminit(27182818);
length ID 8;
array v[6]  _temporary_ (1:4 9 99);
array p1[6] _temporary_ (.1 .2 .4 3*.1);
array p2[6] _temporary_ (2*.05 3*.25 .15);
array p3[6] _temporary_ (2*.15 2*.3 2*.05);
array score[*] CTIOne CTITwo CTIThree;
do ID=1 to 500;
  score[1]=v[rand('table', of p1[*])];
  score[2]=v[rand('table', of p2[*])];
  score[3]=v[rand('table', of p3[*])];
  output;
end;
run;

/* Create scaled mean score CTI3_NewScale (between 0 and 100) */

data want(drop=_:);
set have;
array score[*] CTIOne CTITwo CTIThree;
array _nmCTI[3];
do _i=1 to dim(score);
  if score[_i] in (1:4) then _nmCTI[_i]=score[_i];
  else if score[_i] in (9, 99) then _nmCTI[_i]=.m;
  else put 'WAR' 'NING: Invalid score for ID ' id  +(-1) ': ' score[_i]=;
end;
if n(of _nmCTI[*]) then CTI3_NewScale=(mean(of _nmCTI[*])-1)*100/3;
else CTI3_NewScale=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Feb 2021 11:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716371#M221381</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-02-03T11:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 0-100 score with 3 items  - Linear transformation?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716705#M221541</link>
      <description>&lt;P&gt;Works like a charm! Thanks a million for your help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 00:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-0-100-score-with-3-items-Linear-transformation/m-p/716705#M221541</guid>
      <dc:creator>Kim2009</dc:creator>
      <dc:date>2021-02-04T00:54:45Z</dc:date>
    </item>
  </channel>
</rss>

