rbloggers

Fibonacci sequence in R and SAS

(This article was first published on Heuristic Andrew, and kindly contributed to R-bloggers) Because the Fibonacci sequence is simply defined by recursion, it makes for an elegant programming exercise. Here is one way to do it in SAS, and another way to do it in R. I've also included unit testing code to check that it works. Fibonacci sequence in SAS using a recursive macro:%macro fib(n);%if &n = 1 %then 1; * first seed...