BookmarkSubscribeRSS Feed
nisha_a
Calcite | Level 5

Hi,

 

i am working on a table with the below structure:

 

Trt1                              Trt2                     ...............

related unrelated      related unrelated   ..............

 

There are 10 such treatment groups. In the proc report i have used across option to display the relationship.

 

However, i also want to use the "page" option in the define statement of the trtx variable to break after a few treatment group. Could you please tell me if "across" and "page" be used in the same proc report. If not can you please guide me on what should be done to break after a few treatments?

 

 

2 REPLIES 2
Tom
Super User Tom
Super User

Not sure what you mean and I am having a hard time thinking of a use case where it even makes sense. 

Can you provide the data and code for a small example?  Provide the data in form of a data step with in-line data (or use of the SASHELP datasets).

 

You probably will want to transpose the data so that each treatment group is its own variable.  Then instead of ACROSS you will just list the individual variables in the column statement.  Then you can add the page option to one of the variables in its define statement.

Cynthia_sas
SAS Super FREQ

Hi:

  As @Tom explained, without data or code, it is hard to make a specific recommendation. However, using different data, such as SASHELP.SHOES, I can illustrate how you would get a separate table for every ACROSS item. In the PROC REPORT below, report 1 shows 4 Products (could be 4 treatments). Then underneath each PRODUCT, I have 2 variables -- SALES and RETURNS and with a regular ACROSS usage for PRODUCT, the result is 1 table with a set of columns for each unique value of PRODUCT, as shown below:

sep_table_each_across_var.png

 

If I want to still get a separate table for each unique value of PRODUCT and still use PRODUCT as an ACROSS item, I need to pre-sort the data and use BY PRODUCT inside PROC REPORT. PROC REPORT with a BY will produce a separate table for every BY group (in this case, PRODUCT). So the PROC REPORT code with BY will now generate 1 table for each PRODUCT. The NOBYLINE option suppresses the BYLINE that would normally be underneath each title and on top of the table.

 

  Using PAGE with ACROSS is not something I really recommend. BY group processing is more reliable.

 

Hope this helps,

Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 273 views
  • 0 likes
  • 3 in conversation