BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ellen_F
Calcite | Level 5

Hi Everybody.  I learned SAS in the 1980s but I stopped using it 20 years ago and now I'm back!  (Yay!)

 

I used to love using "Proc Print; by variablex; id variablex;"  but now when I use it, I see repeating headers which makes the report busy, repetitive, and hard to read!

Ellen_F_1-1661876547526.png

Here is my report from non-ODS sas -aka the old school way - notice the column headings are only at the top of the page.  

Ellen_F_0-1661876429855.png

I want to share this report with the milennials that I work with, so I'd like to be able to save it to html and have it look more like the first (ODS) report BUT I would like to keep those pesky headers from repeating.

 

Any ideas would be greatly appreciated!  Many thanks, Ellen

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If you shared the actual Proc Print code you are currently using, better to include example data in the form of a data step, so we can make better suggestions.

 

It appears that you might have been using the BY as a way to get intermediate totals of some sort. If that is the case example data is a very good idea.

 

I might also guess that it is possible that you have done some work to create sequential character values of some summary for each variable of a report period. If that is the actual case you might want to provide data from before creating all those variables as the desired report you show might be made from as few as 3 variables (of the correct type and value) with one of the other reporting procedures.

View solution in original post

3 REPLIES 3
ballardw
Super User

If you shared the actual Proc Print code you are currently using, better to include example data in the form of a data step, so we can make better suggestions.

 

It appears that you might have been using the BY as a way to get intermediate totals of some sort. If that is the case example data is a very good idea.

 

I might also guess that it is possible that you have done some work to create sequential character values of some summary for each variable of a report period. If that is the actual case you might want to provide data from before creating all those variables as the desired report you show might be made from as few as 3 variables (of the correct type and value) with one of the other reporting procedures.

Ellen_F
Calcite | Level 5

Thank you.  The code that created the screen shots on my original post is here:

proc print noobs data = rollmeds2 split='_'; by value_set_item; id value_set_item;

 

The dataset rollmeds2 simply contains value_set_item plus the study period columns.  The values look like numbers but they are character fields that I created with put function statements.

 

Ellen_F_0-1661882079276.png

 

Here is what the input dataset looks like.

 

Ellen_F_0-1661882374357.png

 

 

 

 

ballardw
Super User

I might try:

proc report data = rollmeds2 split='_'; 
 columns value_set_item STudyPeriod: ;
 define value_set/ group;
run;

If you haven't seen it before the Studyperiod: uses the colon indicate a list of variables whose names start with the text before the colon character.

 

Suggestion though, depending on how you created that data set. It is often quite easier to create such summaries from data that looks like

Valueset Date Value and use procedure options to create the summary values and the row/column headings.

For one thing your current data is somewhat susceptible to order changes because you have two entirely different types of values in a single variable. Another is that with an actual SAS date value if you want to combine different periods for a summary that can be done with similar code and just change a format.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 503 views
  • 1 like
  • 2 in conversation