Hello
I saw this code for proc report.
I have some questions please:
1-what is the meaning of writing '_' in column statement?
2-As I see this report is a displayed report (not summary report).
Why do you think that the code writter decided to write "group" and not "Dispaly" (for the first 3 columns)? I see that in the report only in column country the repeated values are eliminated
3- Is the statement "break after country / skip;" create the break line that I marked in yellow?
proc report data=test nowd headline headskip spacing=2 split='~';
column (‘__’ country lab ptno mon1);
define country / group "Country" ;
define lab / group "Lab~Test";
define ptno / group "Patient" width=8;
define mon1 / display "Lab~Value" width=5;
break after country / skip;
run;
One of the best ways to answer some of these questions is to make data set like that and run the code, or use similar options with a different data set.
The '__', or which ever characters are there, provides a heading row text above that of the column variable headers.
Group will display a value only once instead of on each row and provides provides a "sort" (the grouping) by that variable. The appearance of a group variable value one time makes it easier to see that the other columns are related somehow. Display will also just show data in the order of the data set by default.
See the difference between running these two reports:
proc report data=sashelp.class; column sex age; define sex /group; define age /display; run; proc report data=sashelp.class; column sex age; define sex /display; define age /display; run;
The break after as shown will only appear in the LISTING destination. Since the Break is AFTER a variable it places break options after the last value of each group (or Order) variable, in this case the Country variable. Skip means the last bit of the break is a blank line, again only in the listing destination. So it provides a vertical white space after the last Canada and the last USA group of records.
One of the best ways to answer some of these questions is to make data set like that and run the code, or use similar options with a different data set.
The '__', or which ever characters are there, provides a heading row text above that of the column variable headers.
Group will display a value only once instead of on each row and provides provides a "sort" (the grouping) by that variable. The appearance of a group variable value one time makes it easier to see that the other columns are related somehow. Display will also just show data in the order of the data set by default.
See the difference between running these two reports:
proc report data=sashelp.class; column sex age; define sex /group; define age /display; run; proc report data=sashelp.class; column sex age; define sex /display; define age /display; run;
The break after as shown will only appear in the LISTING destination. Since the Break is AFTER a variable it places break options after the last value of each group (or Order) variable, in this case the Country variable. Skip means the last bit of the break is a blank line, again only in the listing destination. So it provides a vertical white space after the last Canada and the last USA group of records.
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.