<?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 Thoughts on efficient approach to problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585820#M167158</link>
    <description>&lt;P&gt;Hello SAS community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on a project and would appreciate thoughts on an efficient way to summarize some data sets that I am building. I will have 30-40 data sets with each data set tracking a unique study. Within each data set there will be one row per person participating in the study. There is one column for every day of the year with the column value indicating the persons status of the study such that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(null) - not calculated in study (for that day)&lt;/P&gt;
&lt;P&gt;0 - failing study&lt;/P&gt;
&lt;P&gt;1 -&amp;nbsp; passing study&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each day of the year (all numeric columns) I want to total all persons participating in the study (all '1's and '0's), all people passing study (all '1's) as well and calculating the percent of population passing (count of '1's / count of '1's and '0's).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 496px;" width="516"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="68" style="width: 76px;"&gt;STUDY&lt;/TD&gt;
&lt;TD width="64" style="width: 66px;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" style="width: 58px;"&gt;d0101&lt;/TD&gt;
&lt;TD width="64" style="width: 58px;"&gt;d0102&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;d0103&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;d0104&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;…&lt;/TD&gt;
&lt;TD width="64" style="width: 61px;"&gt;d1231&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person2&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person3&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person4&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person5&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person6&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person7&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person8&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person9&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 96px; width: 421px;" width="537"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;STUDY&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0101&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0102&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0103&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0104&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;…&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d1231&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;pass&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;3&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;5&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;5&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;total&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;8&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 39px;"&gt;
&lt;TD style="height: 39px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 39px; width: 57px;"&gt;percent pass&lt;/TD&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15pt; width: 53px;"&gt;57.14%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;42.86%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;62.50%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;71.43%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;100.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again there will be 30-40 studies (or data sets) that will need to be summarized, each with 1-3 million rows of data. Any suggestions on an efficient way to summarize the data? From my understanding proc means will not be able to calculate the percent passing. Is a data step my best option here?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit: desired output is a data set.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2019 15:07:55 GMT</pubDate>
    <dc:creator>supp</dc:creator>
    <dc:date>2019-09-03T15:07:55Z</dc:date>
    <item>
      <title>Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585820#M167158</link>
      <description>&lt;P&gt;Hello SAS community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on a project and would appreciate thoughts on an efficient way to summarize some data sets that I am building. I will have 30-40 data sets with each data set tracking a unique study. Within each data set there will be one row per person participating in the study. There is one column for every day of the year with the column value indicating the persons status of the study such that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(null) - not calculated in study (for that day)&lt;/P&gt;
&lt;P&gt;0 - failing study&lt;/P&gt;
&lt;P&gt;1 -&amp;nbsp; passing study&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each day of the year (all numeric columns) I want to total all persons participating in the study (all '1's and '0's), all people passing study (all '1's) as well and calculating the percent of population passing (count of '1's / count of '1's and '0's).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 496px;" width="516"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="68" style="width: 76px;"&gt;STUDY&lt;/TD&gt;
&lt;TD width="64" style="width: 66px;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" style="width: 58px;"&gt;d0101&lt;/TD&gt;
&lt;TD width="64" style="width: 58px;"&gt;d0102&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;d0103&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;d0104&lt;/TD&gt;
&lt;TD width="64" style="width: 59px;"&gt;…&lt;/TD&gt;
&lt;TD width="64" style="width: 61px;"&gt;d1231&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person2&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person3&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person4&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person5&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person6&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person7&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person8&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 76px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 66px;"&gt;person9&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 58px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 59px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 61px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="height: 96px; width: 421px;" width="537"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;STUDY&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0101&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0102&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0103&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d0104&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;…&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;d1231&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;pass&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;3&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;5&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;5&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 19px;"&gt;
&lt;TD style="height: 19px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 19px; width: 57px;"&gt;total&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;8&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;7&lt;/TD&gt;
&lt;TD style="height: 19px; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="height: 19px; width: 53px;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 39px;"&gt;
&lt;TD style="height: 39px; width: 52px;"&gt;study1&lt;/TD&gt;
&lt;TD style="height: 39px; width: 57px;"&gt;percent pass&lt;/TD&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15pt; width: 53px;"&gt;57.14%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;42.86%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;62.50%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;71.43%&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 47px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 53px;"&gt;100.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again there will be 30-40 studies (or data sets) that will need to be summarized, each with 1-3 million rows of data. Any suggestions on an efficient way to summarize the data? From my understanding proc means will not be able to calculate the percent passing. Is a data step my best option here?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;edit: desired output is a data set.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 15:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585820#M167158</guid>
      <dc:creator>supp</dc:creator>
      <dc:date>2019-09-03T15:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585828#M167159</link>
      <description>Hi:&lt;BR /&gt;  A DATA step program would be my last choice. PROC FREQ, PROC TABULATE and PROC REPORT are all able to calculate percents. The key will be to get the program working as you want for 1 data set, then to look at "macro-izing" the program so it can be run on multiple data sets.&lt;BR /&gt;&lt;BR /&gt;  In your desired output, as you show, are you sure that the % you show is correct? I don't think it should be 57.14% for every column based on the numbers you show.&lt;BR /&gt;&lt;BR /&gt;Also, for some of the procedures, it might be easier to restructure the data otherwise, you'll have to list the column names for each day.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 03 Sep 2019 14:02:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585828#M167159</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-09-03T14:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585839#M167163</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input STUDY$ ID$ 	d0101 d0102 d0103;
cards;
study1 person1 .  . 0  
study1 person2 0  0 0  
study1 person3 0  0 1  
study1 person4 1  1 1  
study1 person5 .  . 1  
study1 person6 0  0 1  
study1 person7 1  1 .  
study1 person8 1  1 0  
study1 person9 1  0 1   
;

proc sql noprint;
select name, count(name) into: vars separated by '|', :cnt from dictionary.columns where libname='WORK' and memname='HAVE' and name like 'd%';
quit;

%put &amp;amp;vars &amp;amp;cnt;

options mprint;
%macro test;
proc sql;
create table want as select study, 
%do i = 1 %to &amp;amp;cnt;
sum(%scan(&amp;amp;vars, &amp;amp;i, "|")=1) as %scan(&amp;amp;vars, &amp;amp;i, "|"),
%end;
 'Pass' as status from have 
union 
select study, 
%do i = 1 %to &amp;amp;cnt;
sum(%scan(&amp;amp;vars, &amp;amp;i, "|") ne .) as %scan(&amp;amp;vars, &amp;amp;i, "|"),
%end; 
'Total' as status from have 
union
select study, 
%do i = 1 %to &amp;amp;cnt;
(sum(%scan(&amp;amp;vars, &amp;amp;i, "|") =1)/sum(%scan(&amp;amp;vars, &amp;amp;i, "|") ne .))*100 as %scan(&amp;amp;vars, &amp;amp;i, "|") ,
%end; 
'Percent Pass' as status from have group by study;
quit;
%mend;

%test;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 14:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585839#M167163</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-03T14:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585843#M167166</link>
      <description>&lt;P&gt;Do you need a report or a dataset as result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First idea: transpose + tabulate, unfortunately i don't have the time to finish the code today, the percent-pass row is missing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
   length study id $ 10 d0101-d0105 8;   
   input STUDY ID d0101 d0102 d0103 d0104 d0105;
   datalines;
study1 person1 . . 0 1 1
study1 person2 0 0 0 0 1
study1 person3 0 0 1 1 .
study1 person4 1 1 1 . .
study1 person5 . . 1 1 .
study1 person6 0 0 1 1 1
study1 person7 1 1 . . .
study1 person8 1 1 0 1 .
study1 person9 1 0 1 0 1
;
run;

proc sort data=have presorted;
   by study id;
run;

proc transpose data=work.have
      out=work.transposed(rename=(col1=passed))
      name= day
   ;
   by study id;
   var d0101 d0102 d0103 d0104 d0105;
run;

proc sort data=transposed out=sorted;
   by study day;
run;

proc tabulate data=work.sorted ;  
   var passed;
   class day / order=unformatted missing;
   class study / order=unformatted missing;
   table
      study*
      passed=' '*(
         sum='pass' 
         n='total'
      ),
      day
;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 14:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585843#M167166</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-09-03T14:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585846#M167167</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18331"&gt;@supp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on a project and would appreciate thoughts on an efficient way to summarize some data sets that I am building. I will have 30-40 data sets with each data set tracking a unique study. Within each data set there will be one row per person participating in the study. There is one column for every day of the year with the column value indicating the persons status of the study such that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(null) - not calculated in study (for that day)&lt;/P&gt;
&lt;P&gt;0 - failing study&lt;/P&gt;
&lt;P&gt;1 -&amp;nbsp; passing study&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each day of the year (all numeric columns) I want to total all persons participating in the study (all '1's and '0's), all people passing study (all '1's) as well and calculating the percent of population passing (count of '1's / count of '1's and '0's).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="516" style="width: 496px;"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;STUDY&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;ID&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;d0101&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;d0102&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;d0103&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;d0104&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;…&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;d1231&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person1&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person2&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person3&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person4&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person5&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person6&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person7&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;.&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person8&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 55.02px;"&gt;study1&lt;/TD&gt;
&lt;TD style="width: 54.69px;"&gt;person9&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 44.78px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;0&lt;/TD&gt;
&lt;TD style="width: 45.05px;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="width: 45.58px;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would suggest that the first step would be to put the data in a forma that is better conducive to analysis. You actually have actual data in the variable name, the date, and that can add complications when attempting to answer things like "values by month" or similar.&lt;/P&gt;
&lt;P&gt;I would suggest transposing the data so that you have one record per date and that the date variable hold an actual SAS Date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc means or summary CAN do the percent passing because of the coding scheme you have. The N statistic for any group will give the number of participants, the SUM statistic will give the number of 1 values and the MEAN statistic will give the percentage 1's in a decimal form: .578 =&amp;gt;57.8%.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But do consider transposing the data a mentioned. If you have a date variable you can get the summary by calendar month or quarter by assigning a proper format to the date value.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 14:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585846#M167167</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-03T14:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585855#M167170</link>
      <description>&lt;P&gt;Thanks Cynthia. I did have a typo in my original post as the %'s were not correct. I have corrected it. I will look into the procedures you listed.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 15:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585855#M167170</guid>
      <dc:creator>supp</dc:creator>
      <dc:date>2019-09-03T15:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585865#M167174</link>
      <description>&lt;P&gt;Thanks Jag, I ran the code you provided on about 1.2 million people. It provided the results as expected and took about 2.5 minutes real time to run. Not too bad! Here is some of the log from running the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 2:28.29&lt;BR /&gt;user cpu time 1:48.30&lt;BR /&gt;system cpu time 58.03 seconds&lt;BR /&gt;memory 1068867.39k&lt;BR /&gt;OS Memory 1097204.00k&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 15:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585865#M167174</guid>
      <dc:creator>supp</dc:creator>
      <dc:date>2019-09-03T15:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585866#M167175</link>
      <description>Thanks for testing the code, happy that it worked</description>
      <pubDate>Tue, 03 Sep 2019 15:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585866#M167175</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-03T15:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585867#M167176</link>
      <description>&lt;PRE&gt;data have;
input STUDY $ ID $ d0101 d0102 d0103 d0104  d1231 ;
datalines;
study1 person1 . . 0 1   1 
study1 person2 0 0 0 0   1 
study1 person3 0 0 1 1   . 
study1 person4 1 1 1 .   . 
study1 person5 . . 1 1   . 
study1 person6 0 0 1 1   1 
study1 person7 1 1 . .   . 
study1 person8 1 1 0 1   . 
study1 person9 1 0 1 0   1 
;

proc tabulate data=have;
  class study ;
  var d: ;
  table study=''*(sum='Pass'*f=best5. n='Total' mean='Percent Pass'*f=percent8.2),
        d:
        /misstext=' ' box='Study';
 run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 15:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585867#M167176</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-03T15:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585869#M167177</link>
      <description>&lt;P&gt;Thanks Ballardw. Seems like proc tabulate might be the best option. I ran the code you provided on the same 1.2 million people/rows as the SQL marco solution. It looks like I got the same results and ran very quickly, about 6 seconds real time (compared to 2.5 minutes for the SQL macro solution).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not used proc tabulate before so I will spend some time understanding the syntax. Again thanks for the assist!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 16:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/585869#M167177</guid>
      <dc:creator>supp</dc:creator>
      <dc:date>2019-09-03T16:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Thoughts on efficient approach to problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/586103#M167280</link>
      <description>&lt;P&gt;I know you got brilliant solution. Just for fun for saving output as a dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input STUDY $ ID $ d0101 d0102 d0103 d0104  d1231 ;
datalines;
study1 person1 . . 0 1   1 
study1 person2 0 0 0 0   1 
study1 person3 0 0 1 1   . 
study1 person4 1 1 1 .   . 
study1 person5 . . 1 1   . 
study1 person6 0 0 1 1   1 
study1 person7 1 1 . .   . 
study1 person8 1 1 0 1   . 
study1 person9 1 0 1 0   1 
;


proc sql;
create table want as
select 	study,'  pass' as flag,sum(d0101) as d0101, sum(d0102) as d0102
 from have 
  group by study

union

select 	study,' total' ,count(d0101) as d0101, count(d0102) as d0102
 from have 
  group by study

union

select 	study,'percent',sum(d0101)/count(d0101) as d0101, sum(d0102)/count(d0102) as d0102
 from have 
  group by study

order by 1,2;
quit;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Sep 2019 13:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Thoughts-on-efficient-approach-to-problem/m-p/586103#M167280</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-04T13:19:03Z</dc:date>
    </item>
  </channel>
</rss>

