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

Hi,

I would like to create a final report for each doctor as follows:

 

Doctor A

 

Metric                                      2001           2002            2003

----------------------------------------------------------------------

Hours worked                       2,540           5,789            3,274

Avg pts seen per day               1.25           5.25            0.65

Compensation                      $2001         $2002            $2003

 

<<another completely separate report for Doctor B>>

 

 

I currently have created individual datasets for each metric, normally using proc freq with a "by" statement or proc means with a "by" statement. I have been manually inputting the value of each proc freq or proc means for each doctor into an excel file to look like the above. However, my boss just informed me that my list of doctors has grown to over 100, so doing this manually is not going to work!

 

 

 

I've been reading up on PROC REPORT, PROC TEMPLATE and even PROC PRINT. However, My problem is is that the data years (e.g., 2011) have different formats depending on the metric (e.g., some times I need to format with a dollar sign, other times it's a straight number and other times I need commas to express thousands), so merging by data year is not going to work in a data step.

 

Does anyone have any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

If you have a file with metrics and doctor then:

 

1. Convert all your values to character using PUT and the explicit format of interest.

2. Sort by doctor and metric - you may need to add in an order variable for metric to get the exact order you want. 

3. Use PROC PRINT with a BY DOCTOR to get each doctors report printed into Excel.

View solution in original post

4 REPLIES 4
ballardw
Super User

I would suggest going further back in your process. Describe the content of the starting data before you do your "metrics". Best would be to provide some example data for at least 2 doctors and at least 2 years (which can be partial, the idea to to let us know what the data looks like). Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn a data set into datastep code that can be pasted in the forum or attached as a text file so we can recreate the data and run code.

 

From the results I see, if the data were one record per patient with doctor name, date, payment and time then this could likely be accomplished directly in either proc tabulate or report

sharonlee
Quartz | Level 8

Hi Ballardw,

The data are from a bunch of different datasources. I massage each dataset to come up with what I displayed.

Reeza
Super User

If you have a file with metrics and doctor then:

 

1. Convert all your values to character using PUT and the explicit format of interest.

2. Sort by doctor and metric - you may need to add in an order variable for metric to get the exact order you want. 

3. Use PROC PRINT with a BY DOCTOR to get each doctors report printed into Excel.

sharonlee
Quartz | Level 8

This worked well. To make things look pretty, I outputed using ODS. Thanks!

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!

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
  • 4 replies
  • 818 views
  • 0 likes
  • 3 in conversation