Would you like to format your macro variables? Easy! Just use the %FORMAT function, like this: What?! You never heard of the %FORMAT function? Of course not, cuz it doesn't exist! No problem. Just create it, like this: %macro format(value,format); %if %datatyp(&value)=CHAR %then %sysfunc(putc(&value,&format)); %else %left(%qsysfunc(putn(&value,&format))); %mend format; The %FORMAT
Tag: macro
How many of you have been given a SAS data set with variables such as Age, Height, and Weight and some or all of them were stored as character values instead of numeric? Probably EVERYONE! Yes, we all know how to do the old "swap and drop" (rename and convert), but
The English language, a mishmash of words from many tongues and with rules that aren’t always consistent, sometimes causes people to stumble when writing quotes. There are numerous humorous websites with examples of incorrectly-used quotes on signs saying things like “Sandwiches Prepared ‘Fresh’,” or “Help ‘Wanted’ – Please ‘inquire’ within”.
This week's SAS tip is from Robert Virgile and his illuminating new book SAS Macro Language Magic: Discovering Advanced Techniques. Robert has 30 years of experience developing and teaching SAS classes. And his new book is filled with powerful programming techniques. If you like this week's free excerpt, you can read
This week's SAS tip is from Art Carpenter and his latest book Carpenter's Guide to Innovative SAS Techniques. Art is a talented SAS user and prolific author--and was just recognized in the SAS Circle of Excellence for 30 years of using SAS software. After taking a look at this week's book
It’s early March and one of these days, the snow will melt here in Minnesota, the ice will disappear from the lakes, and spring will arrive. On my list of things to do this spring is a third edition of SAS Macro Programming Made Easy. It’s time to update the
This week's %NLINMIX macro tips come from the esteemed authors of SAS for Mixed Models, Second Edition. Ramon C. Littell, George A. Milliken, Walter W. Stroup, Russell D. Wolfinger, and Oliver Schabenberger combined their expertise to write this indispensable guide. This 800 page book has made a big impact in the user community
As SAS user Marje Fecht said "We all want a 'SAS programming assistant' to help us complete our jobs more quickly." Fecht, Senior Partner at Prowerk Consulting, then went on to say "In her book SAS Macro Programming Made Easy, Second Edition, Michele Burlew encourages us to take advantage of the SAS
If you’ve taken one of my SAS classes you may recall “Mark’s 3 rules of programming”, the first of which is “Lazy programmers are GOOD programmers.” One of the things I love about best about SAS programming is the plethora of functions and shortcuts built into the language, all designed