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?
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.
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
Hi Ballardw,
The data are from a bunch of different datasources. I massage each dataset to come up with what I displayed.
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.
This worked well. To make things look pretty, I outputed using ODS. Thanks!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.