<?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: scaling  (calculating missing with different number of items depending on group) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scaling-calculating-missing-with-different-number-of-items/m-p/602646#M174493</link>
    <description>&lt;P&gt;Without some concrete data example I don't really have a clue what you are doing with "subscaling" or "scaling" here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might post some fake example data if sensitive, the parameters involved and the desired result for the given example data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2019 23:07:53 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-11-07T23:07:53Z</dc:date>
    <item>
      <title>scaling  (calculating missing with different number of items depending on group)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scaling-calculating-missing-with-different-number-of-items/m-p/602645#M174492</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When I work with macro to create sub scales, I normally list the total number of items and then use that number to calculate the missing.&lt;/P&gt;&lt;P&gt;For example, I am creating a scale X with sub scales A B and C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; ScaleX ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;numitemsA = 10;&lt;/P&gt;&lt;P&gt;numitemsB = 3;&lt;/P&gt;&lt;P&gt;numitemsC = 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;missA = nmiss (of I LIST EACH ITEM HERE);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;miss B = nmiss (of I LIST EACH ITEM HERE);&lt;/P&gt;&lt;P&gt;missC = nmiss of I LIST EACH ITEM HERE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if missA = numitemsA then subscaleA=&lt;/STRONG&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;STRONG&gt;;&lt;/STRONG&gt; ** all vars are missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&amp;nbsp;&amp;nbsp; Sub scale A = (mean&amp;nbsp; (of I list the items again)\&lt;/P&gt;&lt;P&gt;I do the same for the other scales and it works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, in one of these sub scales, I have a different total item, depending on the group of participants (cohort). I will use sub scale A to try to explain.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cohort 1 has only 5 of the 10 items of sub scale A (numitemsA) and cohort 2 has all 10 items (from numitemsA).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I thought of doing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;numitemsA = 10;&lt;/P&gt;&lt;P&gt;numitemsAA=5;&lt;/P&gt;&lt;P&gt;numitemsB = 3;&lt;/P&gt;&lt;P&gt;numitemsC = 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If cohort = &lt;STRONG&gt;1&lt;/STRONG&gt; then missAA=nmiss (of list 5 items here);&lt;/P&gt;&lt;P&gt;If cohort = &lt;STRONG&gt;2&lt;/STRONG&gt; then missA=nmiss (of list 10 items here);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if missA = numitemsA then subscaleA=&lt;STRONG&gt;.&lt;/STRONG&gt;; ** all vars are missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&amp;nbsp; subScaleA= (mean (of list 10 items here));&lt;/P&gt;&lt;P&gt;if missAA =&amp;nbsp; numitemsAA then subScaleA=&lt;STRONG&gt;.&lt;/STRONG&gt; ; ** all vars are missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else subScaleA= (mean (of list 5 items here));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also need to do this&lt;/P&gt;&lt;P&gt;if missA gt (&lt;STRONG&gt;.20&lt;/STRONG&gt;*numitemsA) then subscaleA=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if missAA gt (&lt;STRONG&gt;.20&lt;/STRONG&gt;*numitemsAA) then subscaleA=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%mend scaleX;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would this overwrite the data? Or will I get the correct scaleA, calculated differently for each cohort, as shown above?&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 22:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scaling-calculating-missing-with-different-number-of-items/m-p/602645#M174492</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2019-11-07T22:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: scaling  (calculating missing with different number of items depending on group)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scaling-calculating-missing-with-different-number-of-items/m-p/602646#M174493</link>
      <description>&lt;P&gt;Without some concrete data example I don't really have a clue what you are doing with "subscaling" or "scaling" here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might post some fake example data if sensitive, the parameters involved and the desired result for the given example data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 23:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scaling-calculating-missing-with-different-number-of-items/m-p/602646#M174493</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-07T23:07:53Z</dc:date>
    </item>
  </channel>
</rss>

