Want to create ODS output with a header similar to what is in the attached document. I am no expert at ODS programming. This is probably simple to do, but eludes me so far. Any help is appreciated!
This should get you started. There is only one row in the output because your sample data has on one date value in it. I also assumed you want the mean for each day, even though you didn't say that.
data have;
input Obs SITE $ TIMESTAMP :datetime19. TOTE9 DATPT TRIP_P RATM4C DATTT TRIP_T RUNDATE RUNYEAR RUNMONTH RUNDAY;
cards;
1 COLO_A 11FEB2024:00:54:45 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11
2 COLO_A 11FEB2024:00:57:32 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11
3 COLO_A 11FEB2024:01:01:06 30 81.0 7596 14.5 2.9 8850 23417 2024 2 11
4 COLO_A 11FEB2024:02:00:06 30 81.1 7538 14.5 2.9 8850 23417 2024 2 11
5 COLO_A 11FEB2024:03:00:06 30 81.1 7501 14.5 2.9 8850 23417 2024 2 11
6 COLO_A 11FEB2024:04:21:02 30 81.3 7425 14.5 2.9 8850 23417 2024 2 11
7 COLO_A 11FEB2024:05:00:06 30 81.5 7373 14.5 2.9 8850 23417 2024 2 11
8 COLO_A 11FEB2024:05:03:08 30 81.5 7370 14.5 2.9 8850 23417 2024 2 11
9 COLO_A 11FEB2024:06:00:06 30 81.6 7295 14.5 2.9 8850 23417 2024 2 11
10 COLO_A 11FEB2024:07:00:08 30 82.2 7188 14.5 2.7 8899 23417 2024 2 11
11 COLO_A 11FEB2024:08:00:09 30 83.7 7002 14.4 2.7 8899 23417 2024 2 11
12 COLO_A 11FEB2024:09:00:10 30 85.2 6846 14.4 2.7 8898 23417 2024 2 11
13 COLO_A 11FEB2024:10:00:06 30 85.7 6769 14.4 2.7 8898 23417 2024 2 11
14 COLO_A 11FEB2024:11:00:05 30 85.7 6664 14.4 2.7 8898 23417 2024 2 11
15 COLO_A 11FEB2024:12:00:05 30 85.7 6655 14.4 2.7 8898 23417 2024 2 11
16 COLO_A 11FEB2024:13:00:06 30 85.7 6612 14.4 2.7 8898 23417 2024 2 11
17 COLO_A 11FEB2024:14:00:05 30 85.8 6546 14.4 2.7 8898 23417 2024 2 11
18 COLO_A 11FEB2024:15:00:06 30 85.8 6519 14.4 2.7 8898 23417 2024 2 11
19 COLO_A 11FEB2024:16:00:05 30 85.8 6494 14.4 2.7 8898 23417 2024 2 11
20 COLO_A 11FEB2024:17:00:05 30 85.8 6491 14.4 2.7 8898 23417 2024 2 11
;
proc report data=have;
columns timestamp ("Incident" tote9 ratm4c) ("Production" datpt trip_p);
define timestamp/group "Date" format=dtdate9.;
define tot9/"Total E9" mean;
define ratm4c/"Ratm4 C" mean;
define datpt/"Data" mean;
define trip_p/"Trips" mean;
run;
My work computer refuses to allow me to download and open any attachments. Please include the text of your attachment in your reply, not in an attachment.
This can be done via PROC REPORT or PROC TABULATE or maybe even with a SAS data step. I can't be more specific without seeing a portion of the raw data used to create this table.
You maintain the formatting by pasting the text into the window that appears when you click on the "Insert Code" icon.
@drdrewr wrote:
Thank you Paige. Let me go review the documentation for PROC REPORT. I've always used PROC PRINT instead as PROC REPORT just looks so much more daunting. Guess it is time to go into "learning mode"!!!
There is no doubt that PROC REPORT is a more complex procedure than PROC PRINT, but well worth your time in the long run. You might want to search the internet for introductions to PROC REPORT.
As this is relatively simple (to me) in PROC REPORT, providing an example of your actual data would probably get you a quicker answer.
Okay. So here is a snipped of my input. I do a little bit of summarizing, but I keep the same names in the (temporary) summary table:
RUNDATE, TOTE9, RATM4C, DATPT, TRIP_P, DATTT, and TRIP_T are the fields used to create the table output in my earlier post.
The SAS System Sunday, February 11, 2024 05:00:00 PM 1 Obs SITE TIMESTAMP TOTE9 DATPT TRIP_P RATM4C DATTT TRIP_T FILLER RUNDATE RUNYEAR RUNMONTH RUNDAY 1 COLO_A 11FEB2024:00:54:45 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11 2 COLO_A 11FEB2024:00:57:32 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11 3 COLO_A 11FEB2024:01:01:06 30 81.0 7596 14.5 2.9 8850 23417 2024 2 11 4 COLO_A 11FEB2024:02:00:06 30 81.1 7538 14.5 2.9 8850 23417 2024 2 11 5 COLO_A 11FEB2024:03:00:06 30 81.1 7501 14.5 2.9 8850 23417 2024 2 11 6 COLO_A 11FEB2024:04:21:02 30 81.3 7425 14.5 2.9 8850 23417 2024 2 11 7 COLO_A 11FEB2024:05:00:06 30 81.5 7373 14.5 2.9 8850 23417 2024 2 11 8 COLO_A 11FEB2024:05:03:08 30 81.5 7370 14.5 2.9 8850 23417 2024 2 11 9 COLO_A 11FEB2024:06:00:06 30 81.6 7295 14.5 2.9 8850 23417 2024 2 11 10 COLO_A 11FEB2024:07:00:08 30 82.2 7188 14.5 2.7 8899 23417 2024 2 11 11 COLO_A 11FEB2024:08:00:09 30 83.7 7002 14.4 2.7 8899 23417 2024 2 11 12 COLO_A 11FEB2024:09:00:10 30 85.2 6846 14.4 2.7 8898 23417 2024 2 11 13 COLO_A 11FEB2024:10:00:06 30 85.7 6769 14.4 2.7 8898 23417 2024 2 11 14 COLO_A 11FEB2024:11:00:05 30 85.7 6664 14.4 2.7 8898 23417 2024 2 11 15 COLO_A 11FEB2024:12:00:05 30 85.7 6655 14.4 2.7 8898 23417 2024 2 11 16 COLO_A 11FEB2024:13:00:06 30 85.7 6612 14.4 2.7 8898 23417 2024 2 11 17 COLO_A 11FEB2024:14:00:05 30 85.8 6546 14.4 2.7 8898 23417 2024 2 11 18 COLO_A 11FEB2024:15:00:06 30 85.8 6519 14.4 2.7 8898 23417 2024 2 11 19 COLO_A 11FEB2024:16:00:05 30 85.8 6494 14.4 2.7 8898 23417 2024 2 11 20 COLO_A 11FEB2024:17:00:05 30 85.8 6491 14.4 2.7 8898 23417 2024 2 11
This should get you started. There is only one row in the output because your sample data has on one date value in it. I also assumed you want the mean for each day, even though you didn't say that.
data have;
input Obs SITE $ TIMESTAMP :datetime19. TOTE9 DATPT TRIP_P RATM4C DATTT TRIP_T RUNDATE RUNYEAR RUNMONTH RUNDAY;
cards;
1 COLO_A 11FEB2024:00:54:45 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11
2 COLO_A 11FEB2024:00:57:32 30 81.0 7601 14.5 2.9 8850 23417 2024 2 11
3 COLO_A 11FEB2024:01:01:06 30 81.0 7596 14.5 2.9 8850 23417 2024 2 11
4 COLO_A 11FEB2024:02:00:06 30 81.1 7538 14.5 2.9 8850 23417 2024 2 11
5 COLO_A 11FEB2024:03:00:06 30 81.1 7501 14.5 2.9 8850 23417 2024 2 11
6 COLO_A 11FEB2024:04:21:02 30 81.3 7425 14.5 2.9 8850 23417 2024 2 11
7 COLO_A 11FEB2024:05:00:06 30 81.5 7373 14.5 2.9 8850 23417 2024 2 11
8 COLO_A 11FEB2024:05:03:08 30 81.5 7370 14.5 2.9 8850 23417 2024 2 11
9 COLO_A 11FEB2024:06:00:06 30 81.6 7295 14.5 2.9 8850 23417 2024 2 11
10 COLO_A 11FEB2024:07:00:08 30 82.2 7188 14.5 2.7 8899 23417 2024 2 11
11 COLO_A 11FEB2024:08:00:09 30 83.7 7002 14.4 2.7 8899 23417 2024 2 11
12 COLO_A 11FEB2024:09:00:10 30 85.2 6846 14.4 2.7 8898 23417 2024 2 11
13 COLO_A 11FEB2024:10:00:06 30 85.7 6769 14.4 2.7 8898 23417 2024 2 11
14 COLO_A 11FEB2024:11:00:05 30 85.7 6664 14.4 2.7 8898 23417 2024 2 11
15 COLO_A 11FEB2024:12:00:05 30 85.7 6655 14.4 2.7 8898 23417 2024 2 11
16 COLO_A 11FEB2024:13:00:06 30 85.7 6612 14.4 2.7 8898 23417 2024 2 11
17 COLO_A 11FEB2024:14:00:05 30 85.8 6546 14.4 2.7 8898 23417 2024 2 11
18 COLO_A 11FEB2024:15:00:06 30 85.8 6519 14.4 2.7 8898 23417 2024 2 11
19 COLO_A 11FEB2024:16:00:05 30 85.8 6494 14.4 2.7 8898 23417 2024 2 11
20 COLO_A 11FEB2024:17:00:05 30 85.8 6491 14.4 2.7 8898 23417 2024 2 11
;
proc report data=have;
columns timestamp ("Incident" tote9 ratm4c) ("Production" datpt trip_p);
define timestamp/group "Date" format=dtdate9.;
define tot9/"Total E9" mean;
define ratm4c/"Ratm4 C" mean;
define datpt/"Data" mean;
define trip_p/"Trips" mean;
run;
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.