0%

How to insert blank rows - SASlearner

If you'd like to add one blank row in your report, as shown below:

ss_dm_baseline

I suggest there are two methods to implement this requirement.

  • to do that in proc report
  • to do that before proc report

Let's say that we have an example sashelp.class, and wish to divide it into two groups so that we can present them separately.

For the first method, we need to add a gr variable for grouping, such as female and male.

data final;
    set sashelp.class;

    if sex="male" then
        gr=1;
    else gr=2;
run;

proc sort data = final;
    by gr age;
run;

And then, in the proc report procedure, add one line code compute after gr; as shown below. You can see it works.

proc report data=final;
    column gr name sex age height weight;
    define gr  / group order noprint;

    compute after gr;
        line @1 "";
    endcomp;
run;

To use the second method, we simply add one blank row to the final dataset using call missing(of _all_).

data final2;
    set final;
    by sex;
    output;
    if last.sex then do;
        call missing(of _all_);
        output;
    end;
    drop gr;
run;

Just a trick, I hope to help anyone who's learning SAS.