{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise \n", "\n", "If you're up for it, test your understanding of what we discussed about control flow in SAS to write a `%macro` that takes a `start_year`, an `end_year`, and a macro `name` and calls the specified macro for each year inbetween `start_year` and `end_year`. \n", "\n", "````{admonition} Solution\n", ":class: dropdown, success\n", "\n", "``` sas\n", " %macro exercise(start_year, end_year, name);\n", " \n", " %do year = &start_year %to &end_year;\n", " %&name.(&year.);\n", " %end;\n", " \n", " %mend exercise;\n", "```\n", "````" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 4 }