<?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: How Do you Divide two Numbers and Return the Result as a Decimal? in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190181#M4426</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS stores all numbers as floating point and does not automatically round.&amp;nbsp; If the variable you wrote the result into has a format attached then the value might appear as rounded because of the format being applied.&lt;/P&gt;&lt;P&gt;try &lt;/P&gt;&lt;P&gt;put x= best32. ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you perhaps pulling from a database and SAS has pushed the division into the database to execute?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Mar 2015 15:45:16 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-03-03T15:45:16Z</dc:date>
    <item>
      <title>How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190178#M4423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;I am trying to do division on whole numbers and return them as a decimal. I’m getting confused on what the right cast or parse in SAS is.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: upper-alpha;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;E.g.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;A = 5/2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;.. A has a value of 2.5&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 15:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190178#M4423</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-03-03T15:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190179#M4424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;all you need is a semicolon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A=5/2;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 15:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190179#M4424</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-03-03T15:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190180#M4425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; &lt;SPAN style="background: white; font-family: 'Arial',sans-serif; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"&gt;I am using SAS 9.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Arial',sans-serif; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"&gt;I want a result of 2.5 not 2.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; font-family: 'Arial',sans-serif; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"&gt;Dividing two integers in SAS automatically rounds.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 15:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190180#M4425</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-03-03T15:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190181#M4426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS stores all numbers as floating point and does not automatically round.&amp;nbsp; If the variable you wrote the result into has a format attached then the value might appear as rounded because of the format being applied.&lt;/P&gt;&lt;P&gt;try &lt;/P&gt;&lt;P&gt;put x= best32. ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you perhaps pulling from a database and SAS has pushed the division into the database to execute?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 15:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190181#M4426</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-03T15:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190182#M4427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;Tom,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt;This is the same query that you helped me with earlier.&amp;nbsp; I’m querying a total and a subtotal and displaying the result if the subtotal is &amp;gt;65% of the total.&amp;nbsp; When I divide my result acts and looks like 0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Arial',sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;/*query the max degree level*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;SELECT total, &amp;amp;enrRepTy, &amp;amp;degOrStudIDTy into :max_level_total2, :max_level_name2 SEPARATED BY &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, :max_deg_Or_stud_id2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;from&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;( select sum(students_enrolled) as total, &amp;amp;enrRepTy, &amp;amp;degOrStudIDTy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from S_or_D_enroll_indexed_OffCampus&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group &amp;amp;enrRepTy, &amp;amp;degOrStudIDTy)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;having total = max(total);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;/*query total for degree level*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;SELECT sum(students_enrolled) into :total_level_total2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;from S_or_D_enroll_indexed_OffCampus&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: #548235; background: white;"&gt;/*functionally should be %let subgroupRatio = %eval((2683 / 8314);*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; subgroupRatio = &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;((max_level_total2 / total_level_total2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;format subgroupRatio Numeric &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 11.0pt; font-family: 'Courier New';"&gt;12.2&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; (&amp;amp;subgroupRatio &amp;gt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 11.0pt; font-family: 'Courier New';"&gt;.65&lt;/STRONG&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;proc sgrender data=S_or_D_enroll_indexed_OffCampus template=ColorByIndexWDataLab;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;where &amp;amp;degOrStudIDTy EQ &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;max_deg_Or_stud_id2"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;dynamic title1=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;" "&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: #548235; background: white;"&gt;/*subgroupRatio acts like 0 and displays 0*/";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;dynamic title2=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;max_level_name2 only &amp;amp;subgroupRatio &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 16:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190182#M4427</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-03-03T16:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190183#M4428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%EVAL() is a MACRO function.&amp;nbsp; Not really SAS.&lt;/P&gt;&lt;P&gt;To evaluate macro values using floating point you need to %SYSEVALF() not %EVAL().&lt;/P&gt;&lt;P&gt;You probably also want to use %SYSEVALF() in your %IF statement instead of the implied %EVAL() for the same reason.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 16:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190183#M4428</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-03T16:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190184#M4429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You left off the part about I'M USING MACRO LANGUAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use %SYSEVALF to do floating point arithmetic in macro language.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 16:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190184#M4429</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-03-03T16:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: How Do you Divide two Numbers and Return the Result as a Decimal?</title>
      <link>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190185#M4430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Arial',sans-serif; background: white;"&gt;Sysevalf worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2015 18:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-Do-you-Divide-two-Numbers-and-Return-the-Result-as-a-Decimal/m-p/190185#M4430</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-03-03T18:07:27Z</dc:date>
    </item>
  </channel>
</rss>

