BookmarkSubscribeRSS Feed
sahoositaram555
Pyrite | Level 9

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.

4 REPLIES 4
Patrick
Opal | Level 21

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;

 

sahoositaram555
Pyrite | Level 9

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.

 

sahoositaram555_0-1727149533903.png

 

Patrick
Opal | Level 21

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;

 

sahoositaram555
Pyrite | Level 9
@Patrick, I appreciate your reponse, i created this dummy dataset just to post as an example. by using call missing(col1) is not the intention, instead in a dataset level how can i manage to add a blank line when ever the col1 finds a PLACEBO CONTROLLED ?

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 853 views
  • 0 likes
  • 2 in conversation