BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Cruise
Ammonite | Level 13

Please help with direct input in my code below.

 

-How to modify separate "Prevelance" cells into one single title style of "Prevalence"?

-How to left align the cell data?  

 

I would love to read complete SAS documentations to accomplish this but this time I run out of time so bad.

 

proc report data=have nofs headline headskip;
title "Table Title";
column year agecat bf_firstyear,pr_obs pr_obs=average;
define year/group width=4 'Year';
define agecat/group format=agecat. 'Age Groups'; 
define bf_firstyear/across 'Column title' format=format.; 
define pr_obs/display sum format=8.1 'Prevalence';
define average/analysis mean format=comma10.1 'Average';
run; 

Image shows my current output (data blurred).

 

sas support.png

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

You can change the order of the across and analysis variable in the COLUMN statement to achieve something similar. This allows you to have a common heading and suppress one heading using an empty label.

 

Have a look at the sample below.

 

/* 
 * default layout 
 */
proc report data=sashelp.cars;
  column type origin, invoice;
  define type / group;
  define origin / across;
  define invoice / analysis mean;
run;

/*
 * analysis before across var
 */
proc report data=sashelp.cars;
  column type invoice, origin;
  define type / group;
  define origin / across " ";
  define invoice / analysis mean "Invoice mean";
run;

View solution in original post

5 REPLIES 5
BrunoMueller
SAS Super FREQ

You can change the order of the across and analysis variable in the COLUMN statement to achieve something similar. This allows you to have a common heading and suppress one heading using an empty label.

 

Have a look at the sample below.

 

/* 
 * default layout 
 */
proc report data=sashelp.cars;
  column type origin, invoice;
  define type / group;
  define origin / across;
  define invoice / analysis mean;
run;

/*
 * analysis before across var
 */
proc report data=sashelp.cars;
  column type invoice, origin;
  define type / group;
  define origin / across " ";
  define invoice / analysis mean "Invoice mean";
run;
Cruise
Ammonite | Level 13

Thank you. One more question please. Anyone knows how to order the appearance of column? I'd like to have NEVER column as the first column in the output table. It's the reference group.

BrunoMueller
SAS Super FREQ
I suggest you start a new discussion with the appropriate title, makes it easier for everyone to find and answer to the question
ballardw
Super User

@Cruise wrote:

Thank you. One more question please. Anyone knows how to order the appearance of column? I'd like to have NEVER column as the first column in the output table. It's the reference group.


In addition to @BrunoMueller's suggestion of a new thread, Provide example data in the form of a data step and the proc format code to create your age category format.

The actual values of the variables and format options can interact in a number of ways to get things in a specific order and could actually require a proc sort before the report depending on the contents of those elements.

 

With example data in the form of data step code then tested solutions may be provided. Without data you'll tend to get guesses that may or may not work with your actual data.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1152 views
  • 1 like
  • 4 in conversation