<?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: tricky numeric transformations in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84086#M24121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am so glad you write this in Base SAS as opposed to SQL. I am in the process of trying to learn by group processing and do loops. I have a few questions. I am not to sure whats happening in the parts of the code in bold&amp;nbsp; of the code and I can't seem to see what the significance of the variable &lt;STRONG&gt;tot_points &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;data want&amp;nbsp; (drop=Total_Homes tot_points);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then Total_Homes=Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp; else Total_Homes+Total_of_Homes;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Type_Proportion=Total_of_Homes/Total_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Points_Available=Home_Type_Proportion*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Points_Earned=Points_Available*Compliance_Rate;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then tot_points=Home_Points_Earned;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tot_points+Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Points=tot_points;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Score=Total_Points*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Aug 2012 20:03:26 GMT</pubDate>
    <dc:creator>RobertNYC</dc:creator>
    <dc:date>2012-08-03T20:03:26Z</dc:date>
    <item>
      <title>tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84080#M24115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some tricky numeric transformations I’m having trouble figuring out. I'm finding them tricky because I have to start by basing the scores off to values in one variable.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data set below are the variables I start with plus the variables I need to calculate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 720px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl27" colspan="5" height="17" style="text-align: center; color: #575757; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="327"&gt;&lt;STRONG&gt;Start With &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl27" colspan="5" style="text-align: center; color: #575757; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="393"&gt;&lt;STRONG&gt;Variables which need to be calculated &lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl27" height="17" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl27" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl27" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl27" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;D&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl27" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl36" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;F&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl36" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;G&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl36" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;H&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl36" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;I&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl36" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;J&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl22" height="34" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="38"&gt;Office &lt;/TD&gt;&lt;TD class="xl23" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="80"&gt; &lt;STRONG&gt;Certification&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl24" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="83"&gt;Total_of_Homes &lt;/TD&gt;&lt;TD class="xl25" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="40"&gt;Closed&lt;/TD&gt;&lt;TD class="xl26" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="86"&gt;Compliance_Rate&lt;/TD&gt;&lt;TD class="xl33" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="96"&gt;&lt;SPAN style="color: #ff0000;"&gt;Home_Type_Proportion&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl34" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="84"&gt;&lt;SPAN style="color: #ff0000;"&gt;Points_Available&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl34" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="82"&gt;&lt;SPAN style="color: #ff0000;"&gt;Home_Points_Earned&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD class="xl35" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="67"&gt;&lt;STRONG style="color: #ff0000;"&gt;Total _Points&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl33" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="64"&gt;&lt;STRONG style="color: #ff0000;"&gt;Total_Score&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl22" height="17" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="38"&gt;Office1 &lt;/TD&gt;&lt;TD class="xl22" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="80"&gt;&lt;STRONG&gt;12 -month&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl28" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;173&lt;/TD&gt;&lt;TD class="xl29" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;1%&lt;/TD&gt;&lt;TD class="xl30" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;99%&lt;/TD&gt;&lt;TD class="xl29" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;88%&lt;/TD&gt;&lt;TD class="xl31" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;8.8&lt;/TD&gt;&lt;TD class="xl31" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;8.8&lt;/TD&gt;&lt;TD class="xl31" rowspan="2" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;9.8&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl29" rowspan="2" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;98%&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl22" height="17" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="38"&gt;Office1 &lt;/TD&gt;&lt;TD class="xl22" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="80"&gt;&lt;STRONG&gt;kinship 90 days&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl28" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;23&lt;/TD&gt;&lt;TD class="xl29" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;13%&lt;/TD&gt;&lt;TD class="xl30" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;87%&lt;/TD&gt;&lt;TD class="xl29" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;12%&lt;/TD&gt;&lt;TD class="xl31" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;1.2&lt;/TD&gt;&lt;TD class="xl31" style="color: #575757; text-align: center; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;1.0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I need to start by calculating a &lt;STRONG&gt;Home_Type_Proportion &lt;/STRONG&gt;for the values&lt;STRONG&gt; &lt;/STRONG&gt;of&lt;STRONG&gt; &lt;/STRONG&gt;“12-month” and&lt;STRONG&gt; “&lt;/STRONG&gt;kinship 90 days” so the calculations look like this:&amp;nbsp; &lt;/LI&gt;&lt;LI&gt;“12-month”&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp; &lt;/STRONG&gt;C4/(C4+C5)&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp; Home_Type_Proportion&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;“kinship 90 days”&amp;nbsp; =&amp;nbsp; C5/(C4+C5)&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp; &lt;STRONG&gt;Home_Type_Proportion&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt; &lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Then I need to calculate &lt;STRONG&gt;Points_Available:&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;“12-month”&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Type_Proportion&amp;nbsp;&amp;nbsp; =&amp;nbsp; &lt;/STRONG&gt;F4*10&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;= Points_Available&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;“kinship 90 days”&amp;nbsp; &lt;STRONG&gt; Home_Type_Proportion&amp;nbsp;&amp;nbsp; =&amp;nbsp; &lt;/STRONG&gt;F5*10&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; = Points_Available&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt; &lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Then I need to calculate &lt;STRONG&gt;Home_Points_Earned:&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt; &lt;/STRONG&gt;“12-month”&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Points_Available&amp;nbsp; =&amp;nbsp; &lt;/STRONG&gt;G4*E4&lt;STRONG&gt;&amp;nbsp; =&amp;nbsp; Home_Points_Earned&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;“kinship 90 days”&lt;STRONG&gt; Points_Available&amp;nbsp; &lt;/STRONG&gt;=&amp;nbsp; G5*E5&amp;nbsp; =&amp;nbsp; &lt;STRONG&gt;Home_Points_Earned&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt; &lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Then I need to Combine “12-month”&amp;nbsp; and “kinship 90 days” to get:&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Total _Points =&lt;/STRONG&gt;H4+H5&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;And last&lt;STRONG&gt;&amp;nbsp; Total_Score = &lt;/STRONG&gt;I4/10&lt;STRONG&gt; &lt;/STRONG&gt;or&lt;STRONG&gt; Home_Points_Earned / 10&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Can you see why this may be a little tricky to figure out? Any help is greatly appreciated!&amp;nbsp; Thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84080#M24115</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2012-08-03T19:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84081#M24116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I see your references to Row 4 and Row 5 (C4, C5), but if your column header cells are in Row 1, I only see Row 2 and Row 3. (see screenshot) So, can you explain what data is in Row 4 and Row 5???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, what is the structure of your SAS dataset? You show an Excel worksheet -- is your data already in SAS form, or does information need to be read into or imported into SAS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10939i28B7869BC621F778/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="confusion_row_nums.png" title="confusion_row_nums.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84081#M24116</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-08-03T19:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84082#M24117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are working with a SAS dataset, you could use a dow loop to achieve the result you want.&amp;nbsp; I didn't bother to do any of the implied rounding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat office $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat certification $20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat closed compliance_rate percent3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Office Certification &amp;amp; Total_of_Homes Closed Compliance_Rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Office1&amp;nbsp; 12-month&amp;nbsp; 173&amp;nbsp; 1%&amp;nbsp; 99%&lt;/P&gt;&lt;P&gt;Office1&amp;nbsp; kinship 90 days&amp;nbsp; 23&amp;nbsp; 13%&amp;nbsp; 87%&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=Total_Homes tot_points);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then Total_Homes=Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else Total_Homes+Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Type_Proportion=Total_of_Homes/Total_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Points_Available=Home_Type_Proportion*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Points_Earned=Points_Available*Compliance_Rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then tot_points=Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tot_points+Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Points=tot_points;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Score=Total_Points*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84082#M24117</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-03T19:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84083#M24118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Cynthia--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, so sorry the row numbers are off they should be C2 and C3 the row with letter values were just for illustration purposes. Yes, the data is already in SAS format. I just used excel for the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84083#M24118</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2012-08-03T19:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84084#M24119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a two step SQL solution.&lt;/P&gt;&lt;P&gt;You could probably do it in one but I didn't feel like working out the math &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input office certification $ total_of_homes close compliance_rate;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 12M&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 173 .01 .99&lt;/P&gt;&lt;P&gt;1 Kinship 23&amp;nbsp; .13 .87&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table step1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, sum(total_of_homes) as n_homes format=8.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; total_of_homes/calculated n_homes as home_type_proportion format=percent8.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calculated home_type_proportion*10 as points_available format=8.1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calculated points_available*compliance_rate as home_points_earned format=8.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by office;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table step2 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select *, sum(home_points_earned) as total_points format=8.1,&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; sum(home_points_earned)/10 as total_score format=percent8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from step1&lt;/P&gt;&lt;P&gt;group by office;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84084#M24119</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-08-03T19:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84085#M24120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming you want this calculation for each Office and the two Certifications are present for each office This SQL query will do the trick :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;length certification $20;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;input office $ Certification $ Total_of_Homes Closed :percent3. Compliance_Rate :percent3.;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;datalines;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Office1 12-month 173 1% 99%&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Office1 kinship_90_days 23 13% 87%&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;create table want as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select office, Certification, Total_of_Homes, Closed, Compliance_Rate,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_of_Homes/sum(Total_of_Homes) as Home_Type_Proportion format=percentn5.0,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 * calculated Home_Type_Proportion as Points_Available format=4.1,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Compliance_Rate * calculated Points_Available as Home_Points_Earned format=4.1,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 * sum(Total_of_Homes*Compliance_Rate) / sum(Total_of_Homes) as Total_Points format=4.1,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calculated Total_Points/10 as Total_Score&amp;nbsp; format=percentn5.0&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;from have&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;group by office;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select * from want;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 19:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84085#M24120</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-08-03T19:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84086#M24121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am so glad you write this in Base SAS as opposed to SQL. I am in the process of trying to learn by group processing and do loops. I have a few questions. I am not to sure whats happening in the parts of the code in bold&amp;nbsp; of the code and I can't seem to see what the significance of the variable &lt;STRONG&gt;tot_points &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;data want&amp;nbsp; (drop=Total_Homes tot_points);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then Total_Homes=Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp; else Total_Homes+Total_of_Homes;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run; &lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Type_Proportion=Total_of_Homes/Total_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Points_Available=Home_Type_Proportion*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Points_Earned=Points_Available*Compliance_Rate;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then tot_points=Home_Points_Earned;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tot_points+Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Points=tot_points;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Score=Total_Points*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 20:03:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84086#M24121</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2012-08-03T20:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: tricky numeric transformations</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84087#M24122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Robert: I used Total_Homes and tot_points as placeholders so that the total values of each could be accumulated during the loop.&amp;nbsp; Both are dropped by the time the file is actually written.&amp;nbsp; To understand what is actually happening through the two loops, it is easiest (I think) to add a couple of putlog _all_; statements in the code.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat office $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat certification $20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat closed compliance_rate percent3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Office Certification &amp;amp; Total_of_Homes Closed Compliance_Rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Office1&amp;nbsp; 12-month&amp;nbsp; 173&amp;nbsp; 1%&amp;nbsp; 99%&lt;/P&gt;&lt;P&gt;Office1&amp;nbsp; kinship 90 days&amp;nbsp; 23&amp;nbsp; 13%&amp;nbsp; 87%&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want (drop=Total_Homes tot_points);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then Total_Homes=Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else Total_Homes+Total_of_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putlog _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.office);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by office;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Type_Proportion=Total_of_Homes/Total_Homes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Points_Available=Home_Type_Proportion*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Home_Points_Earned=Points_Available*Compliance_Rate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.office then tot_points=Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tot_points+Home_Points_Earned;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Points=tot_points;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total_Score=Total_Points*10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; putlog _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 20:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/tricky-numeric-transformations/m-p/84087#M24122</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-03T20:35:02Z</dc:date>
    </item>
  </channel>
</rss>

