<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/5-ways-a-sas-health-check-can-simplify-a-transition-to-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.mango-solutions.com/blog/5-ways-a-sas-health-check-can-simplify-a-transition-to-r"> Mango Solutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p> <img src="https://i1.wp.com/www.mango-solutions.com/blog/images/b/8/7/c/a/b87ca8842b04dbdeb829450ed2e6074f8c40ec54-health1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<h5>Nic Crane, Data Scientist</h5>
<p>At Mango, we’re seeing more and more clients making the decision to modernise their analytics process; moving away from SAS and on to R, Python, and other technologies. There are a variety of reasons for this, including SAS license costs, the increase of recent graduates with R and Python skills, SAS becoming increasingly uncommon, or the need for flexible technologies which have the capability for advanced analytics and quality graphics output. </p>
<p>While such transitions are typically about much more than just technology migration, the code accounts for a significant degree of the complexity. So, in order to support our clients, we have developed a software suite to analyse the existing SAS code and simplify this process. </p>
<p>So how can a SAS Code Health Check help you decide on how to tackle this kind of transformation?</p>
<h4>1. Analyse procedure calls to inform technology choice</h4>
<p><img alt="" src="https://i0.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p><img alt="" src="https://i1.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health2.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Using the right technology for the right job is important if we want to create code which is easy to maintain for years, saving us time and resources. But how can we determine the best tool for the job?</p>
<p>A key part of any SAS code analysis involves looking at the procedure calls in the SAS codebase to get a quick view of the key functionality. For example, we can see from the analysis above that this codebase mainly consists of calls to PROC SORT and PROC SQL –SAS procedures which reorder data and execute SQL commands used for interacting with databases or tables of data. As there are no statistics related procs, we may decide —if we migrate this application away from SAS— to move this functionality directly into the database. The second graph shows an application which has a high degree of statistical functionality, using the FORECAST, TIMESERIES, and ARIMA procedures to fit complex predictive time series models. As R has sophisticated time series modelling packages, we might decide to move this application to R.</p>
<h4>2. Use macro analysis to find the most and least important components of an application</h4>
<p><img alt="" src="https://i0.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health3.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Looking at the raw source code doesn’t give us any context about what the most important components of our codebase are. How do we know which code is most important and needs to be prioritised? And how can we avoid spending time redeveloping code which has been written, but is never actually used?</p>
<p>We can answer these questions by taking a look at the analysis of the macros and how often they’re used in the code. Macros are like user-defined functions which can combine multiple data steps, proc steps, and logic, and are useful for grouping commands we want to call more than once.</p>
<p>Looking at the plot above, we can see that the transfer_data macro is called 17 times, so we know it’s important to our codebase. When redeveloping the code, we might want to pay extra attention to this macro as it’s crucial to the application’s functionality.</p>
<p>On the other hand, looking at load_other, we can see that it’s never called – this is known as ‘orphaned code’ and is common in large legacy codebases. With this knowledge, we can automatically exclude this to avoid wasting time and resource examining it.</p>
<h4>3. Looking at the interrelated components to understand process flow</h4>
<p><img alt="" sizes="100vw" src="https://i1.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health4.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>When redeveloping individual applications, planning the project and allocating resources requires an understanding of how the different components fit together and which parts are more complex than others. How do we gain this understanding without spending hours reading every line of code?</p>
<p>The process flow diagram above allows us to see which scripts are linked to other scripts. Each node represents a script in the codebase, and is scaled by size. The nodes are coloured by complexity. Looking at the diagram above, we can instantly see that the create_metadata script is both large and complex, and so we might choose to assign this to a more experienced developer, or look to restructure it first. </p>
<h4>4. Examine code complexity to assess what needs redeveloping and redesigning</h4>
<p><img alt="" sizes="100vw" src="https://i1.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health5.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Even with organisational best practice guidelines, there can still be discrepancies in the quality and style of code produced when it was first created. How do we know which code is fit for purpose, and which code needs restructuring so we can allocate resources more effectively? </p>
<p>Thankfully, we can use ‘cyclomatic complexity’ which will assess how complex the code is. The results of this analysis will determine: whether it needs to be broken down into smaller chunks, how much testing is needed, and which code needs to be assigned to more experienced developers.</p>
<h4>5. Use the high level overview to get an informed perspective which ties into your strategic objectives</h4>
<p><img alt="" sizes="100vw" src="https://i0.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health6.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p><img alt="" sizes="100vw" src="https://i2.wp.com/www.mango-solutions.com/blog/user/pages/01.blog/145.5-ways-a-sas-health-check-can-simplify-a-transition-to-r/health7.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Analytics modernisation programs can be large and complex projects, and the focus of a SAS Code Health Check is to allow people to make well-informed decisions by reducing the number of unknowns. So, how do we prioritise our applications in a way that ties into our strategic objectives?</p>
<p>The overall summary can be used to answer questions around the relative size and complexity of multiple applications; making it possible to estimate more accurately on the time and effort required for redevelopment. Custom comparison metrics can be created on the basis of strategic decisions. </p>
<p>For example, if your key priority is to consolidate your ETL process and you might first focus on the apps which have a high number of calls to proc SQL. Or you might have a goal of improving the quality of your graphics and so you’ll focus on the applications which produce a large number of plots. Either way, a high level summary like the one below collects all the information you need in one place and simplifies the decision-making process.</p>
<p>SAS conversion projects tend to be large and complicated, and require deep expertise to ensure their success. A SAS Health Check can help reduce uncertainty, guide your decisions and save you time, resources and, ultimately, money. </p>
<p>If you’re thinking of reducing or completely redeveloping your SAS estate, and want to know more about how Mango Solutions can help, get in touch with with our team today via <a rel="nofollow" href="mailto:sales@mango-solutions.com" target="_blank">sales@mango-solutions.com</a> or +44 (0)1249 705 450.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.mango-solutions.com/blog/5-ways-a-sas-health-check-can-simplify-a-transition-to-r"> Mango Solutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/1JOLW8B0Nfc" height="1"></a></div>