i have a query in proc report.
i am struggling to get the following output.
i have to display the following column in proc report as group a group variable.
i have concatenated variable of age,race,sex. then how can i display that concatenated variable below subject Id in the same cell. and this is to be grouped.
Through the use of ODS ESCAPECHAR, you can introduce a "line break" character into your output file. In the program sample below, the ESCAPECHAR that I use is the tilde (~). Note how the tilde is used in the DATA step program where the variable values are concatenated. Then, the ESCAPECHAR is declared in the ODS ESCAPECHAR statement inside my ODS "sandwich":
length strvar $100;
strvar = trim(name)||'~n('||
ods html file='stackvals.html' style=sasweb;
ods rtf file='stackvals.rtf';
ods pdf file='stackvals.pdf';
ods escapechar = '~';
proc report data=newclass nowd
column strvar name age height;
define strvar / order 'Name~n(Age Height)~nOther'
define name / order 'Name Only';
define age / display 'Age Only';
define Height / display 'Height Only' f=5.1;
ods _all_ close;
The cellwidth=1in was needed on my system because otherwise Word broke the string for Age and Height between the two values. You do not say how you concatentated the variable values. It is possible to do the concatenation in PROC REPORT, also, but that approach, while more efficient because it makes one pass through the data, is also more complicated because of your requirement to group on the concatenated field. If you are interested in pursuing the second approach, I recommend reading the HELP topics:
The REPORT Procedure --> Concepts: REPORT Procedure
The REPORT Procedure --> How PROC REPORT Builds a Report
OR contacting Tech Support for further help.