Hi,
I am facing problem a problem to add blank line after certain condition:
ROC REPORT DATA=final_report2 NOWD MISSING HEADLINE SPACING=2 SPLIT='~';
COLUMN (cntr Country sort Variable Stat DummyRed DummyBlue Total);
DEFINE cntr / ORDER ORDER=data WIDTH=20 FLOW NOPRINT;
DEFINE Country /'Country' display WIDTH=10 FLOW STYLE=[cellwidth=2 cm];
DEFINE sort / ORDER ORDER=internal noprint;
DEFINE Variable /'Variable' ORDER ORDER=data WIDTH=20 FLOW;
/* DEFINE sort1 / ORDER NOPRINT;*/
DEFINE Stat / 'Stat' WIDTH=20 FLOW;
DEFINE DummyRed/'Dummy Red~N=658' WIDTH=20 FLOW STYLE=[ASIS=on cellwidth=3 cm];
DEFINE DummyBlue/'Dummy Blue~N=656' WIDTH=20 FLOW STYLE=[ASIS=on cellwidth=3 cm];
DEFINE Total/'Total~N=1773' WIDTH=20 FLOW RIGHT STYLE=[cellwidth=2.5 cm];
BREAK AFTER cntr / PAGE;
COMPUTE after sort;
IF sort in (1 2 3) then LINE @1 ' ';
ENDCOMP;
RUN;
-There are 5 Numeric Sort at Dataset : SORT = 1 , 2, 3, 4, 5 but i want to put line only after SORT (1, 2, 3)?
-But above BOLD Marked not working?
Do you now why?
Rwgards
Sami
hi Sami
Proc REPORT will always created break lines when using the LINE statement in a COMPUTE block. there is also the follwoing restriction:
Restrictions: | This statement is valid only in a compute block that is associated with a location in the report. |
You cannot use the LINE statement in conditional statements (IF-THEN, IF-THEN/ELSE, and SELECT) because it is not executed until PROC REPORT has executed all other statements in the compute block. |
see the doc for details.
There might me a away around this by using some inlineformatting functions.
Find below a sample program that illustrates this, seems to work ok, for HTML.
data have;
set sashelp.class;
sort = mod(_n_, 6);
run;
ods escapechar="~";
proc report data=have;
column sort name sex age;
define sort / order;
define name / display;
define sex / display;
define age / display;
compute after sort / style={fontsize=2pt };
length msg $ 64;
if sort in (1,2,3) then do;
msg = "~{newline 10}";
end;
else do;
msg = "~{newline 0}";
end;
line msg $64.;
endcomp;
run;
Bruno
hi Sami
Proc REPORT will always created break lines when using the LINE statement in a COMPUTE block. there is also the follwoing restriction:
Restrictions: | This statement is valid only in a compute block that is associated with a location in the report. |
You cannot use the LINE statement in conditional statements (IF-THEN, IF-THEN/ELSE, and SELECT) because it is not executed until PROC REPORT has executed all other statements in the compute block. |
see the doc for details.
There might me a away around this by using some inlineformatting functions.
Find below a sample program that illustrates this, seems to work ok, for HTML.
data have;
set sashelp.class;
sort = mod(_n_, 6);
run;
ods escapechar="~";
proc report data=have;
column sort name sex age;
define sort / order;
define name / display;
define sex / display;
define age / display;
compute after sort / style={fontsize=2pt };
length msg $ 64;
if sort in (1,2,3) then do;
msg = "~{newline 10}";
end;
else do;
msg = "~{newline 0}";
end;
line msg $64.;
endcomp;
run;
Bruno
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.