How To Become A Lazy Programmer - Sas Institute

2y ago
16 Views
2 Downloads
1.05 MB
6 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Nora Drum
Transcription

Paper 4718-2020How to Become a Lazy ProgrammerBalakumar Marappa Gounder Ponnusamy, Element Technologies Inc.ABSTRACTAs a programmer, how often do you see yourself writing the same skeleton of a code againand again? Quite often right? What if you can cut down that time just by using thenecessary fillers? This paper will walk you through how to implement and share abbreviationmacros using SAS Enhanced editor on Windows. This is nothing but an approach tobecome a lazy programmer in SAS Enterprise Guide (SAS EG).INTRODUCTIONThe goal of this presentation is to make any SAS programmer understand what anabbreviation macro is and how it can be used to the best of its potential. The content alsoprovides an idea of how to record macros and improvise them. At the end, you will realizehow easy it is save your programming time and become lazy.ABBREVIATION MACROSAn abbreviation macro is a user defined string that when executed fills in pre-defined longerstring which could be a SAS procedure, header information or any template of text. It willneed a name and the related string that should pop-up when the macro is run. It is storedwith an extension of .kmf.CREATING ABBR. MACROSCreating an abbreviation macro is very simple.1. Click Program - Add Abbreviation Macro 2. In the pop-up window, write the name of the macro under Abbreviation3. Insert or type the text which has to be abbreviated and Click Ok to save themacroFigure 1. SAS EG Snapshot -to create/add an Abbreviation macro1

Figure 2. SAS EG Snapshot - Dialogue Box for Macro Name and ContentMETHODS TO RUN ABBR. MACROSMethod 1:To run the macro in the SAS program window1. Pressing Control key and Spacebar, it provides a list of predefined SAS macrosand list of abbreviation macros with which you can select your macro2. Type in your macro name and press enterMethod 2:Click Program - Editor Macros - Macros and select your macro and then Click Run.Figure 3. SAS EG Snapshot - Method 2 to run Abbr. MacroAPPLICATIONSIn day-to-day programming, I use abbreviation macros for the following purposes1. Syntax Skeletons2. SAS Job Header3. Business oriented template codes4. Logins and SQL connections5. Knowledge sharing2

SYNTAX SKELETONSSAS syntaxes can be harder to remember as there are numerous procedures and otherrelated keywords to do various actions. There will be some 10 to 20 PROC statements thatare used regularly. A lot of time can be saved when those are created as abbreviationmacros.For example, I have created an abbreviation macro with a name “ summary” and whenrun the macro, the Skeleton of PROC SUMMARY will be output and I just have to fill in thenecessary details to get the desired summary.Figure 4. SAS EG Snapshot - Method 2 to run Abbr. MacroSAS JOB HEADERMy job requires me to create report and ad-hoc requests for customers. It is necessary forus to provide details of the request as comments at top. When I start to work on thatrequest, I fill in the necessary information in the program header. This way any analyst whoreviews or takes over the code, will have a better understanding by reading the informationprovided under header of SAS job.BUSINESS TEMPLATE CODESAs a healthcare analyst, most of my work involves creating membership and claims report.Since the data pull has a standard template of code, it became easier to create anabbreviation macro for such business oriented codes.LOGINS AND SQL CONNECTIONThe data is spread out in various databases and it requires us to have multiple logininformation and different database connections. Creating macros for different databases willease the programming and this can help in avoiding providing wrong passwords in the SQLconnections.KNOWLEDGE SHARINGThe best part of creating abbreviation macros is that we can export/import and share it withthe team. This can be done via Enhanced Editor in Program drop down. Clicking onExport will let you save the macro as .kmf file. We can also import by clicking Import from3

the desired location. Similarly, there are other options like Assigning keyboard shortcut torun a macro, Edit/Delete existing macros.STEPS TO EXPORT:1. Click Program - Editor Macros - Macros2. Clicking on Macro that is to be exported3. Click Export will let you save the macro as .kmf fileSTEPS TO IMPORT:1. Click Program - Editor Macros - Macros2. Click Import3. Navigate to desired path4. Click on the necessary macro to import and then Click OK5. Then Close the pop-up windowFigure 5. SAS EG Snapshot – Keyboard Macro optionsRECORDING MACROS IN SAS ENTERPRISE GUIDE Certain actions in coding are repetitive. In general, I use Find/Replace, Copy/Paste orInsert/Delete during coding. We can minimize that time using the recorded macros in SASEnterprise Guide . SAS Editor Macros has a “RECORD MACRO” feature. In keyboard, whenwe press Ctrl Shift R, SAS initiates to record the next actions being performed withinthat SAS Enterprise Guide environment. By pressing Ctrl Shift R again, SAScompletes the recording and asks to save it with a name.STEPS:When in Program window,1. Click Program - Editor Macros - Record New2. Perform your necessary actions until you think it is complete3. Click Program - Editor Macros - Stop Recording4. Provide a Name for the recorded macro5. To review/edit the macro, Click Program - Editor Macros - Macros - 4

Figure 6. SAS EG Snapshot – Recording a Macro option6. Select your recorded macro and Click EditFigure 7. SAS EG Snapshot – A Recorded MacroFor example, if someone needs to convert the windows path to UNIX path, the actionperformed is find and replace the forward and backward slashes. If this action can berecorded as macro and assigned with a keyboard shortcut, ample amount of time is savedby pressing that shortcut.5

CONCLUSIONSAS Abbreviation macros help in reducing the coding time to huge extent. This will let theprogrammer to be more creative in his business areas and focus less on memorizing orgoogling the syntax. Recording, creating macros and assigning a keyboard shortcut to it willcut down more manual effort on those tasks. The best part is to create and share withothers with which they can also be benefitted. The idea of using an abbreviation macro isnot restricted to the topics discussed.REFERENCESCeranowski, Elizabeth. 2009. “SAS Abbreviations Are Your Friends; Use a TemplateMethod to Code!” Proceedings of the SAS Global Forum 2009. Washington, ings09/073- 2009.pdfBikwemu, R. (2017). SAS Abbreviation: The Snippets that Keep on Giving. Retrieved fromhttps://www.lexjansen.com/wuss/2017/110 Final Paper PDF.pdfConsidering a Sas Global Forum 2015 Presentation? Try an E-poster! David Moors- Sas e-poster-2/CONTACT INFORMATIONYour comments and questions are valued and encouraged. Contact the author at:Balakumar Marappa Gounder PonnusamyElement Technologies Inc.balakumarpa@gmail.com6

1 Paper 4718-2020 How to Become a Lazy Programmer . Balakumar Marappa Gounder Ponnusamy, Element Technologies Inc. ABSTRACT . As a programmer, how often do y

Related Documents:

Figure 1: Illustration of lazy mirror descent MD vs Lazy MD Although Lazy MD follows exactly the same trajectory as MD in the EGD example, in general the behavior of MD and Lazy MD can be different. This is because lazy MD reduces computation by dropping the step of going back and forth between the primal and the dual, and simply averaging the

Section 3 presents our novel lazy rewriting system. Section 4 summarizes the implementation of Lazy Racket and presents a model of the lazy stepper, and Section 5 presents a correctness proof for the stepper. 2 Lazy Racket and its Stepper Lazy Racket programs are a series of de nitions and expressions that refer to those de nitions.

This book is the third in the Lazy DM's series, alongside Return of the Lazy DM and The Lazy DM's Workbook. As with each of those books, you don't need to read the entire series to find value in this book. Each title stands alone, but also works together with the others to help you run great fantasy RPGs. Return of the Lazy DM offers an .

Lazy Days Tote Diagram 5 C.Neubauer 0 DAAM 4 1 1 tt4 " APQ October 2002 acobs Ladder Diagrams 002 00222 Quilts and More Summer 200 Lazy Days Tote Diagram 4 C.Neubauer 0 APQ October 2002 acobs Ladder Diagrams 002 APQ00 Quilts and More Summer 200 Lazy Days Tote Diagram 3 C.Neubauer DAAM 3 DIAGRAM 9 21 4" 21 4" DIAGRAM 1 Stitching lines Pencil .

lazy-MDPs. We study the theoretical properties of lazy-MDPs, ex-pressing value functions and characterizing greediness and optimal solutions. Then we empirically demonstrate that policies learned in lazy-MDPs generally come with a form of interpretability: by construction, they show us the states where the agent takes control over the default .

B. The Lazy Shortest Path (LAZYSP) Framework We are interested in shortest path algorithms that minimize the number of evaluated edges jEevalj.1 These are lazy algo-rithms, i.e. they seek to defer the evaluation of an edge as much as possible. When this laziness is taken to the limit, one arrives at the Lazy Shortest Path (LAZYSP) class of .

Building a Lazy-Susan Cabinet Revolving shelves on heavy-duty carousel hardware make the most of a kitchen corner I have no idea who dreamed up the lazy Susan, but I bet a Hoosier had something to do with it. Indiana, after all, is the birthplace of the famed Hoosier cabinet, and Indiana is where I came across a lazy-Susan corner cabinet for .

Being a lazy dungeon master isn’t just about saving time. It’s about spending time where it has the most impact on the enjoyment of you and your group. There are other more dangerous things than simply wasting time. Let’s . The Lazy Dungeon MasT er Michae L e. s