{"id":405,"date":"2021-09-23T09:54:55","date_gmt":"2021-09-23T07:54:55","guid":{"rendered":"http:\/\/jvdl.me\/wordpress\/?p=405"},"modified":"2021-09-23T09:56:02","modified_gmt":"2021-09-23T07:56:02","slug":"significant-figures-in-sas","status":"publish","type":"post","link":"https:\/\/jvdl.me\/blog\/?p=405","title":{"rendered":"Significant Figures in SAS"},"content":{"rendered":"\n<p>For three significant figures, the SAS Institute provides the following <a href=\"http:\/\/support.sas.com\/kb\/24\/728.html\" data-type=\"URL\" data-id=\"http:\/\/support.sas.com\/kb\/24\/728.html\">code snippet<\/a> to accomplish the task.<\/p>\n\n\n\n<p>However, it is often useful to round to more or less than 3 significant figures. I&#8217;ve developed a macro to do so for my own use and am sharing the code below. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sas\" class=\"language-sas line-numbers\">%macro _nsigfig(varin=, varout=, n=);\nif &amp;varin. = 0 then &amp;varout. = 0;\nelse do;\n\tif int(&amp;varin.) ^= 0 then do;\n\t    &amp;varout. = round(&amp;varin., 10**(int(log10(abs(&amp;varin.))) + (1 - &amp;n.)));\n\tend;\n\telse do;\n\t    &amp;varout. = round(&amp;varin., 10**(-1*(abs(int(log10(abs(&amp;varin.)))) + &amp;n.)));\n\tend;\nend;\n%mend _nsigfig;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For three significant figures, the SAS Institute provides the following code snippet to accomplish the task. However, it is often useful to round to more or less than 3 significant figures. I&#8217;ve developed a macro to do so for my own use and am sharing the code below.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67,53,54],"tags":[68,55,73,74],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-pharma","category-programming","category-sas","tag-pharma","tag-sas","tag-sigfig","tag-significant-figures"],"_links":{"self":[{"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=405"}],"version-history":[{"count":2,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=\/wp\/v2\/posts\/405\/revisions\/407"}],"wp:attachment":[{"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jvdl.me\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}