data have;
set sashelp.cars;
where type = 'Sedan' and drivetrain = 'All' and msrp < 35000;
sr=_N_;
keep sr origin make model msrp;
run;
proc report data=have out=rect;
columns sr origin make model msrp;
define sr / order noprint;
compute after sr;
length linetext $200.;
if sr=6 or sr=8 then
linetext = ' ';
line linetext $200.;
endcomp;
run;
i want blank line after sr=6 and sr=8
data have;
set sashelp.cars;
where type = 'Sedan' and drivetrain = 'All' and msrp < 35000;
sr=_N_;
keep group origin make model msrp; /*<-----------*/
if sr=7 or sr=9 then group+1; /*<-----------*/
run;
proc report data=have nowd;
columns group origin make model msrp;
define group/order noprint;
compute before group;
n+1;x=' ';
if n=1 then len=0;else len=10;
line x $varying10. len;
endcomp;
run;
Make the LINE statement conditionally:
compute after sr;
length linetext $200.;
linetext = "";
if sr=6 or sr=8 then
line linetext $200.;
endcomp;
data have;
set sashelp.cars;
where type = 'Sedan' and drivetrain = 'All' and msrp < 35000;
sr=_N_;
keep group origin make model msrp; /*<-----------*/
if sr=7 or sr=9 then group+1; /*<-----------*/
run;
proc report data=have nowd;
columns group origin make model msrp;
define group/order noprint;
compute before group;
n+1;x=' ';
if n=1 then len=0;else len=10;
line x $varying10. len;
endcomp;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.