Tag: AAG

Pivot tables and Cheezy Graphs? No more…

As any good analyst knows, working with data is not the problem. Good analysts have the skill necessary to combine, split, merge, slice, aggregate, or summarize data any way you can imagine. However, is that enough? Probably not.. What good does data do if you can’t communicate its meaning in a logical way. The day […]

SAS – Lowercase (lowcase) / Uppercase (upcase) / Proper Case (propcase)

We can’t stress the importance handling character case correctly. Here are the two functions you need to know and use correctly. In order to convert all characters in a sting to lowercase, use the LOWCASE function. Example: data ds_2; set ds_1; *convert it to lowercase; new_char_var=lowcase(OLD_CHAR_VAR); run; In order to convert all characters in a […]

SAS INTNX function ( add days, months, years, etc )

The INTNX function increments dates, times, or datetimes by specific or custom intervals. Here is the basic syntax for INTNX: INTNX(interval[multiple.shift-index], start, increment[, alignment]) The interval can be a set value like – DAY, WEEK, DTWEEK, YEAR, etc. You can also specify a custom interval. We will post more on that later. The multiple is […]

SAS DIM function – Counting the elements in an array

The DIM function returns the number of literal elements in an array. It functions against multi-dimensional arrays as well as one-dimensional arrays. 1-dimensional array example DIM(array_name) Multi-dimensional array examples DIM(m_array) -> returns the number of elements in the first dimension of the array DIM5(m_array) -> returns the number of elements in the 5th dimension of […]

SAS DIF function – Comparing previous records

The SAS DIF function is another useful tool for operating on previous records. Lets say you want to know the difference in the last year’s revenue and this year’s revenue. Here is the data: Year          Revenue 2001           10,000 2002          30,000 2003          60,000 2004          100,000 data revenue1; set revenue; Rev_increase=dif1(revenue); run; Year          Revenue         Rev_increase 2001           10,000         […]