On any given day, on an average, good programmers spend maybe about 10-20% of their time writing code. And the remaining 90% thinking, researching, and experimenting to find the best design. With so much thinking time, they need every bit of help to reduce the amount of typing time. Not-so-good programmers spend much of that 90% debugging code by randomly making changes and seeing if that works, but I’m sure you’re not one of them!
So why not let Santa come to the rescue just for the programmers in your holiday list who suffer from “lazy programmer syndrome.”
1. The why-do-I-have-to-type-a-million-variable-names programmer
Fed up of typing out long winded variable names. Worry no more. Variable shortcuts make mincemeat of all the typing work.
Numbered range list
Try X=Sum(of var1-var4);
Instead of x=sum(var1, var2, var3, var4)
Name range list
2 hyphens in the variable list gets you everything from var1 to qtr, doesn’t matter what’s in between
Try X=Sum(of var1 -- qtr);
Instead of x=sum(var1, second, q3, qtr)
Try X=Sum(of var:);
Instead of x=sum(var1, varjan, varfeb, vartot);
Special name list
Try X=Sum(of _numeric_);
Instead of x=Sum(var1, qtr, varjan, varfeb);
2. The I’m-too-cool-to-type-the-full-path programmer
Give them this
Libname santa ‘.’;
Instead of Libname santa ‘s:\workshop’;
Just be sure to tell them that they need to at least make sure that their working folder in their SAS session points to the right data folder (red arrow).
3. The I-hate-gluing-data programmer
Sick of having to type multiple vertical bars to glue character data together. You’ll feel so much better when you use the slick and feline CATX operator. Not only does it glue together your character values, but it also converts numeric if you happen to have mistakenly forgotten to convert. Now how’s that for a bonus stocking stuffer?
Which one do you like?
Phone = cat(‘(‘, Code,’) ‘,Mobile);
Phone='(' !! put(Code,3.) !! ') ' !! Mobile;
Do you suffer from the lazy programmer syndrome? Looking for more ways to cut down code? Try our SAS Macro Language 1: Essentials class.
“A great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer.” –Bill Gates