<?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: Summing Variables in an Array in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215885#M53115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am going to be doing my regression analysis in SUDAAN since it handles complex survey data faster and requires to be coded 1/2 instead of 0/1- yes, it is a pain. This is un-redacted data so I don't think I am allowed to share this information- will have to ask my boss. BUT I did just do some 2X2 tables to see if everything matches up and it appears to for the rows I have looked at so far. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2015 17:44:09 GMT</pubDate>
    <dc:creator>daszlosek</dc:creator>
    <dc:date>2015-08-03T17:44:09Z</dc:date>
    <item>
      <title>Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215881#M53111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an array with eight dichotomous (yes,no) variables and I want to sum the variables such that I get a range of scores 0-8 (0 being none of them have any 'yes's' and 8 being all of the variables are yes. Then for any of the scores lower than 4 I would like to make missing. I am getting the SUM of all the variables as a dichotomous and not an 8 level score. Is there a better way to code this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ARRAY ACE_ARRAY[8]&amp;nbsp; ACEPRISN2 ACEDIVRC2 ACEDEPRS2 ACESXAB ACESUBS ACEPUNCH2 ACESWEAR2 ACEHURT2;&lt;/P&gt;&lt;P&gt;SUM_ACESCORE = sum(of ACE_ARRAY[8]);&lt;/P&gt;&lt;P&gt;IF SUM_ACESCORE &amp;lt;= 4 then SUM_ACE = ' ';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Donald S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215881#M53111</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-08-03T16:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215882#M53112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think the expression "of ACE_ARRAY[8]" is going to work for you like your are thinking it will.&amp;nbsp; NOW if the variables are always going to be adjacent in the dataset-- i.e. they have consecutive variable numbers (see proc contents) -- then you could use the syntax "of ACEPRISN2 -- ACEHURT2" (that's a double dash) and that would be the appropriate use of the "of" operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the array then you want to use a do loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;SUM_ACESCORE = &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; i=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;to&lt;/SPAN&gt; &lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; i;&lt;BR /&gt;&amp;nbsp; SUM_ACESCORE+ACE_ARRAY&lt;I&gt;;&lt;BR /&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 17:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215882#M53112</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2015-08-03T17:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215883#M53113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you PhilC, I believe this code works the way I want it to. From the proc freq, It seems odd to me that the Score starts at 8 and goes to 16. See below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="c proctitle"&gt;The FREQ Procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV align="center"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Freq: One-Way Frequencies"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;8&lt;/TH&gt;&lt;TD class="r data"&gt;302&lt;/TD&gt;&lt;TD class="r data"&gt;0.29&lt;/TD&gt;&lt;TD class="r data"&gt;302&lt;/TD&gt;&lt;TD class="r data"&gt;0.29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;9&lt;/TH&gt;&lt;TD class="r data"&gt;1071&lt;/TD&gt;&lt;TD class="r data"&gt;1.04&lt;/TD&gt;&lt;TD class="r data"&gt;1373&lt;/TD&gt;&lt;TD class="r data"&gt;1.33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;10&lt;/TH&gt;&lt;TD class="r data"&gt;2135&lt;/TD&gt;&lt;TD class="r data"&gt;2.07&lt;/TD&gt;&lt;TD class="r data"&gt;3508&lt;/TD&gt;&lt;TD class="r data"&gt;3.40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;11&lt;/TH&gt;&lt;TD class="r data"&gt;3447&lt;/TD&gt;&lt;TD class="r data"&gt;3.34&lt;/TD&gt;&lt;TD class="r data"&gt;6955&lt;/TD&gt;&lt;TD class="r data"&gt;6.74&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;12&lt;/TH&gt;&lt;TD class="r data"&gt;5300&lt;/TD&gt;&lt;TD class="r data"&gt;5.14&lt;/TD&gt;&lt;TD class="r data"&gt;12255&lt;/TD&gt;&lt;TD class="r data"&gt;11.87&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;13&lt;/TH&gt;&lt;TD class="r data"&gt;7819&lt;/TD&gt;&lt;TD class="r data"&gt;7.58&lt;/TD&gt;&lt;TD class="r data"&gt;20074&lt;/TD&gt;&lt;TD class="r data"&gt;19.45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;14&lt;/TH&gt;&lt;TD class="r data"&gt;12048&lt;/TD&gt;&lt;TD class="r data"&gt;11.67&lt;/TD&gt;&lt;TD class="r data"&gt;32122&lt;/TD&gt;&lt;TD class="r data"&gt;31.13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;15&lt;/TH&gt;&lt;TD class="r data"&gt;21507&lt;/TD&gt;&lt;TD class="r data"&gt;20.84&lt;/TD&gt;&lt;TD class="r data"&gt;53629&lt;/TD&gt;&lt;TD class="r data"&gt;51.96&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;16&lt;/TH&gt;&lt;TD class="r data"&gt;49574&lt;/TD&gt;&lt;TD class="r data"&gt;48.04&lt;/TD&gt;&lt;TD class="r data"&gt;103203&lt;/TD&gt;&lt;TD class="r data"&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I assume that the level "8" is 8/8 yes's, level "7" is 7/8 "yes's"&amp;nbsp; etc. and that level "16" is "no yes's"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 17:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215883#M53113</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-08-03T17:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215884#M53114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variables could be dichotomous, but have the values 1 and 2?&amp;nbsp; It's not clear to me.&amp;nbsp; We need a ~10 row sample of the data, a proc contents, and the code you used to add up the variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 17:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215884#M53114</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2015-08-03T17:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215885#M53115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am going to be doing my regression analysis in SUDAAN since it handles complex survey data faster and requires to be coded 1/2 instead of 0/1- yes, it is a pain. This is un-redacted data so I don't think I am allowed to share this information- will have to ask my boss. BUT I did just do some 2X2 tables to see if everything matches up and it appears to for the rows I have looked at so far. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 17:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215885#M53115</guid>
      <dc:creator>daszlosek</dc:creator>
      <dc:date>2015-08-03T17:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Variables in an Array</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215886#M53116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No pain is involved, if you see the data as 1's and 2's then its not odd, at all, that the range is 8 to 16.&amp;nbsp; Thanks for flagging my responses as helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 18:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-Variables-in-an-Array/m-p/215886#M53116</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2015-08-03T18:13:31Z</dc:date>
    </item>
  </channel>
</rss>

