Count of missing and nonmissing values for each variable in a SAS data set

Count missing and Non-missing values for each variable – In SAS, we often need to get the count of missing and non-missing values in a SAS dataset. The code used in this example uses PROC FORMAT to create the format for character and numeric variables to be either “non-missing” or “missing” and then use that …

Read moreCount of missing and nonmissing values for each variable in a SAS data set

Generating Multiple Excel Files

The macro is dynamic to generate multiple Excel files containing the frequency results for each unique BY-group. (e.g., Type). In this SAS example,  PROC SQL SELECT code is embedded inside a macro. The SELECT query processes the column (passed in the macro parameter) then create a macro variable with the number of unique (distinct) value …

Read moreGenerating Multiple Excel Files

Retrieve file size or last modified date of an external file

The FINFO functions return the value of a file specified. You can get six attributes named ‘info items’ through the use of the FINFO function. To read multiple within a directory, the DOPEN, DNUM and DREAD functions can be used. The DOPEN function is similar to the FOPEN function and it returns a directory identifier …

Read moreRetrieve file size or last modified date of an external file

Generating sum of rolling data Using the Lag function

Rolling Data also known as Moving average is a time-based calculations to get an insight of trends for a defined period of time. If time frame for moving average is 12 months, on each month the data which is 13 month old be dropped and the new months data will be added. In the below …

Read moreGenerating sum of rolling data Using the Lag function