<?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 to programm arctangent in degrees? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695642#M212303</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12887"&gt;@ErikLund_Jensen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using SAS 9.4, there is also a new DEGREES function available.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is apparently what the OP tried to use. However, as long as this function is (strangely enough) only available in &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=allprodsle&amp;amp;docsetTarget=syntaxByType-function.htm&amp;amp;locale=en#p0mk1jlsqnxtssn1lks1wlm9bt1mp1lc0o8vn264ctn17xr7q0cj8i88" target="_blank" rel="noopener"&gt;FedSQL&lt;/A&gt;, I think there's nothing easier than the manual conversion if you need it in a different procedure such as PROC NLIN.&lt;/P&gt;</description>
    <pubDate>Sat, 31 Oct 2020 11:26:45 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-10-31T11:26:45Z</dc:date>
    <item>
      <title>How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695600#M212279</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a model to estimate different parameters about germinating fungi. I've already successfully estimated the slope at the inflection point of the data using the estimated result for its first derivation at the zero value of the second derivation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For better visualization, I would like to transfer this value into an angle using the function atan(slope). Sadly I'm not able to transfer the result from a value in radians to degrees. I've tried to use the 'degrees' statement but It doesn't work the way I've used it (tried different variations).&lt;/P&gt;&lt;P&gt;I'm using SAS Studio 3.8&lt;/P&gt;&lt;P&gt;Any suggestions?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the used code:&lt;/P&gt;&lt;P&gt;The line I'm referring to is 115 estimate 'angle of slope inflection'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fungi;
     input time germrate;
     datalines;
9       0
9       0
9       0
9       0
9       0
9       0
9       0
9       0
12      1
12      1
12      1
9       1
12      2
12      3
12      4
12      4
12      5
12      5
15      11
15      18
15      20
15      21
9       22
15      24
15      27
15      27
9       28
9       28
9       29
9       31
9       33
15      34
15      37
18      43
18      45
18      52
18      52
18      54
15      55
18      58
18      58
18      63
18      71
21      72
12      73
21      74
12      74
12      76
12      76
12      77
21      78
15      79
12      80
21      81
15      82
21      83
21      84
21      84
24      85
15      85
24      86
21      86
24      87
21      87
21      87
24      88
24      90
24      90
24      90
21      90
18      90
18      91
15      91
24      92
24      92
21      92
21      92
21      92
18      92
24      93
24      93
18      93
15      93
24      94
24      94
24      95
24      96
18      96
21      97
18      98


   ;


proc nlin  data=fungi;
 	parms   Pmax=98 tau=15 ;d=5 ;

 	model germrate = Pmax*(1-(1/(1+((time/tau)**d))));
run;

proc nlin data=fungi method=newton;   
	parameters  Pmax=98 tau=15 ;d=5 ;
	x=(tau*(((d-1)/(d+1)))**(1/d));
	model germrate = Pmax*(1-(1/(1+((time/tau)**d)))); 
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean l95=l95ind u95=u95ind; 
	estimate 'slope tau' (d*Pmax*((tau/tau)**d)/(tau*((((tau/tau)**d)+1)**2)));	
	
	*/ estimate 'slope turning' (d*Pmax*((x/tau)**d)/(x*((((x/tau)**d)+1)**2))) ;
	estimate 'slope inflection' (d*Pmax*(((tau*(((d-1)/(d+1)))**(1/d))/tau)**d)/((tau*(((d-1)/(d+1)))**(1/d))*(((((tau*(((d-1)/(d+1)))**(1/d))/tau)**d)+1)**2))) ;
	
	estimate 'angle of slope inflection' (select degrees(atan((d*Pmax*(((tau*(((d-1)/(d+1)))**(1/d))/tau)**d)/((tau*(((d-1)/(d+1)))**(1/d))*(((((tau*(((d-1)/(d+1)))**(1/d))/tau)**d)+1)**2)))))) ;
	
run; 

proc print data=nlinout; 
run;

data filler;   
do time = 0 to 96 by 2;     
predict=1;     
output;   
end; 
run;

data fitthis; 
set fungi filler; 
run;

proc nlin data=fitthis method=newton;   
	parameters  Pmax=98 tau=15 ;d=5 ;  
	model germrate = Pmax*(1-(1/(1+((time/tau)**d))));   
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean; 
run; 

proc print data=nlinout(where=(predict=1)); run;

proc sort data = nlinout;
  by time;
run;

proc sgplot data=nlinout;
	band upper=u95mean lower=l95mean x=time; 
   scatter x=time y=germrate;
   series x=time y=pred;
   
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 22:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695600#M212279</guid>
      <dc:creator>RobinN</dc:creator>
      <dc:date>2020-10-30T22:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695631#M212293</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The conversion factor from radians to degrees is 180/&lt;FONT face="symbol"&gt;p&lt;/FONT&gt;. So I'd write&lt;/P&gt;
&lt;PRE&gt;estimate 'angle of slope inflection' &lt;STRONG&gt;180/constant('pi')*&lt;/STRONG&gt;atan(...);&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Oct 2020 10:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695631#M212293</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-10-31T10:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695632#M212294</link>
      <description>&lt;P&gt;Kudos for a very well done question (subject line, source data, code example).&lt;/P&gt;
&lt;P&gt;This could actually be used as a positive example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just one hint: when using DATALINES, avoid empty lines in the datalines block, and have the terminating semicolon at the start of the line.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2020 10:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695632#M212294</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-31T10:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695639#M212301</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using SAS 9.4, there is also a new DEGREES function available.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2020 11:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695639#M212301</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2020-10-31T11:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695642#M212303</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12887"&gt;@ErikLund_Jensen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using SAS 9.4, there is also a new DEGREES function available.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is apparently what the OP tried to use. However, as long as this function is (strangely enough) only available in &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=allprodsle&amp;amp;docsetTarget=syntaxByType-function.htm&amp;amp;locale=en#p0mk1jlsqnxtssn1lks1wlm9bt1mp1lc0o8vn264ctn17xr7q0cj8i88" target="_blank" rel="noopener"&gt;FedSQL&lt;/A&gt;, I think there's nothing easier than the manual conversion if you need it in a different procedure such as PROC NLIN.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2020 11:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695642#M212303</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-10-31T11:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695643#M212304</link>
      <description>Haven't thought of a simple manual conversion, thanks!&lt;BR /&gt;Btw:&lt;BR /&gt;The function is that long due to the input of a function to calculate the x value for the turning point at every position the x variable is needed. So three times a function inside a function. Tried to calculate this variable as an expression inside of 'estimate' or 'proc nlin' but it didn't work for me. So my solution isn't clean but it does the job &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Sat, 31 Oct 2020 11:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695643#M212304</guid>
      <dc:creator>RobinN</dc:creator>
      <dc:date>2020-10-31T11:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695645#M212305</link>
      <description>&lt;P&gt;I think the formulas in the ESTIMATE statements can be simplified substantially: In addition to several redundant pairs of parentheses there are many factors &lt;FONT face="courier new,courier"&gt;tau&lt;/FONT&gt; cancelling out (most obviously in "&lt;FONT face="courier new,courier"&gt;(tau/tau)&lt;/FONT&gt;") as well as exponentiation of the form &lt;FONT face="courier new,courier"&gt;(...**(1/d))**d&lt;/FONT&gt;. Not surprisingly, the results (from your sample data) don't change if I write:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;estimate 'slope tau' d*Pmax/(4*tau);		
estimate 'slope inflection' d*Pmax*&amp;amp;q/(tau*(&amp;amp;q)**(1/d)*(&amp;amp;q+1)**2);
estimate 'angle of slope inflection' 180/constant('pi')*atan(d*Pmax*&amp;amp;q/(tau*(&amp;amp;q)**(1/d)*(&amp;amp;q+1)**2));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;after defining&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let q=(d-1)/(d+1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Oct 2020 12:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/695645#M212305</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-10-31T12:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to programm arctangent in degrees?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/696025#M212501</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I was sure this could be further simplified but hadn't found the time yet as it worked and other things seemed to be of greater importance. Nevertheless many thanks for your cleanup! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 19:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-programm-arctangent-in-degrees/m-p/696025#M212501</guid>
      <dc:creator>RobinN</dc:creator>
      <dc:date>2020-11-02T19:47:42Z</dc:date>
    </item>
  </channel>
</rss>

