In this blog and in the book Statistical Programming with SAS/IML Software, I present tips and techniques for writing efficient SAS/IML programs for data analysis, simulation, matrix computations, and other topics of interest to statistical programmers.
When I was writing my book, one of the reviewers commented that he wasn’t sure why some advice was labeled a "tip" whereas other advice was labeled a "technique."
A tip is general advice. For example, "brush your teeth every day" is a good tip for oral hygiene. A technique describes the specific algorithm for brushing your teeth: angle your brush at 45 degrees, brush gently using short strokes, and so on.
The same distinction applies to programming tips and techniques. Techniques are usually illustrated by SAS/IML statements or pseudo-code. For example, I think every SAS/IML programmer needs to know the following tip:
Tip: Use the LOC function to identify observations that satisfy some criteria.
A related technique shows you how to analyze the observations after they are found:
Technique: If c is a categorical variable, then the following SAS/IML statements analyze all observations in each category of c:
uC = unique(c); do i = 1 to nrow(uC); idx = loc(c = uC[i]); /** idx contains obs in i_th category **/ /** ...analyze those observations here... **/ end;