Hi All, i have a dataset as below.
data dummy; length col1 $200;
col1="BASELINE Heart Rate";output;
col1='PLACEBO-CONTROLLED Heart Rate';output;
col1='WEEK 2 Heart Rate';output;
col1='WEEK 4 Heart Rate';output;
col1='WEEK 8 Heart Rate';output;
col1='WEEK 12 Heart Rate';output;
col1='WEEK 18 Heart Rate';output;
col1='BASELINE SYSBP';output;
col1='PLACEBO-CONTROLLED SYSBP';output;
col1='WEEK 2 SYSBP';output;
col1='WEEK 4 SYSBP';output;
col1='WEEK 8 SYSBP';output;
col1='WEEK 12 SYSBP';output;
col1='WEEK 18 SYSBP';output;
col1='BASELINE DIABP';output;
col1='PLACEBO-CONTROLLED DIABP';output;
col1='WEEK 2 DIABP';output;
col1='WEEK 4 DIABP';output;
col1='WEEK 8 DIABP';output;
col1='WEEK 12 DIABP';output;
col1='WEEK 18 DIABP';output;
RUN;
I would like to insert 1 blank row each below the rows PLACEBO-CONTROLLED Heart Rate, PLACEBO-CONTROLLED SYSBP, PLACEBO-CONTROLLED DIABP.
how this can be achieved, please suggest, I heard call missing would work, but unable to do so.
I assume you want to add such empty rows for some reporting purposes. If so then that would be a very suboptimal approach. I suggest you explain us what you have and what you want to achieve for us to provide some advice.
Below code to answer your question (but... don't do it. SAS tables and Excel sheets are very different things).
data dummy; length col1 $200;
col1="BASELINE Heart Rate";output;
call missing(col1); output;
/* and so on */
col1='PLACEBO-CONTROLLED Heart Rate';output;
col1='WEEK 2 Heart Rate';output;
col1='WEEK 4 Heart Rate';output;
col1='WEEK 8 Heart Rate';output;
col1='WEEK 12 Heart Rate';output;
col1='WEEK 18 Heart Rate';output;
col1='BASELINE SYSBP';output;
col1='PLACEBO-CONTROLLED SYSBP';output;
col1='WEEK 2 SYSBP';output;
col1='WEEK 4 SYSBP';output;
col1='WEEK 8 SYSBP';output;
col1='WEEK 12 SYSBP';output;
col1='WEEK 18 SYSBP';output;
col1='BASELINE DIABP';output;
col1='PLACEBO-CONTROLLED DIABP';output;
col1='WEEK 2 DIABP';output;
col1='WEEK 4 DIABP';output;
col1='WEEK 8 DIABP';output;
col1='WEEK 12 DIABP';output;
col1='WEEK 18 DIABP';output;
RUN;
Even though the ultimate goal is reporting, but i want to have the blank line at the dataset level as shown in the attached snap.
You shouldn't mix display layout with data structure. Proc Report would also allow to add such empty lines at the beginning or the end of a group. But o.k., here you go:
data want;
set dummy;
output;
if col1 =: 'PLACEBO-CONTROLLED' then
do;
call missing(col1);
col0='week 2';
output;
end;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.