SAS code for replacing missing values with 0 in a folder full of datasets

%macro loopOverDatasets();
/*imho good practice to declare macro variables of a macro locally*/
%local datasetCount datasetName iter inMember;

/*get number of datasets + name of datasets*/
proc sql noprint ;
select count(*)
into: datasetCount
from dictionary.tables
where libname = “EXAM”;

/*initiate loop*/
%let iter=1;
%do %while (&iter.<= &datasetCount.);

proc sql noprint;
select memname
into: datasetName
from dictionary.tables
where libname = “EXAM” and monotonic() eq &iter.;

%put &iter &datasetCount &datasetName &inMember;
/*now you can apply your logic to the dataset*/
data &datasetName.;
set exam.&datasetName.;
array change _numeric_;
do over change;
if change=. then change=0;

%let iter=%eval(&iter.+1);


2015 in review

The stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

A San Francisco cable car holds 60 people. This blog was viewed about 590 times in 2015. If it were a cable car, it would take about 10 trips to carry that many people.

Click here to see the complete report.