BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hi , 

 

I need to add a blank line after each category ("Discrepancy") in ods excel.

 

current output:

HitmonTran_0-1655237425783.png

 

want output (spacing when values of 'Discreancy' changes):

HitmonTran_1-1655237474823.png

 

current code:

proc report data=flufin;
title 'Flu'; columns subject serial compdtc ct fresult flg flg2; define subject / display 'ID'; define serial / display 'Cart SN'; define compdtc / display 'Date'; define ct / display 'Ct'; define fresult / display 'Discrepancy'; define flg / display noprint; define flg2 /computed noprint; compute flg2; if flg = 1 then do; call define('subject','style','style={background=yellow}'); end; endcomp;

run;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The basic thing you are looking for is

 

Compute after discrepancy;

   line ' ';

endcomp;

 

which would expect Discrepancy to be either an ORDER or Group variable. That may mean that you need to add another variable with the group/order roll that is not printed.

Example that uses a data set you should have available so you can run this code.

proc sort data=sashelp.class
   out=work.class;
   by age;
run;

data work.class;
   set work.class;
   groupage =age;
run;
proc report data=work.class;
   columns groupage name age weight;
   define groupage/order noprint;
   define name /display;
   define age /display;
   define weight /display;
compute after groupage; line " "; endcomp; run;

View solution in original post

1 REPLY 1
ballardw
Super User

The basic thing you are looking for is

 

Compute after discrepancy;

   line ' ';

endcomp;

 

which would expect Discrepancy to be either an ORDER or Group variable. That may mean that you need to add another variable with the group/order roll that is not printed.

Example that uses a data set you should have available so you can run this code.

proc sort data=sashelp.class
   out=work.class;
   by age;
run;

data work.class;
   set work.class;
   groupage =age;
run;
proc report data=work.class;
   columns groupage name age weight;
   define groupage/order noprint;
   define name /display;
   define age /display;
   define weight /display;
compute after groupage; line " "; endcomp; run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 766 views
  • 0 likes
  • 2 in conversation