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

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller

View solution in original post

11 REPLIES 11
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
drdrewr
Calcite | Level 5
When I do that, it ruins all the spacing so it will be impossible to see what I am looking to do. As a text attachment, the formatting stays the same.
drdrewr
Calcite | Level 5

drdrewr_0-1707688873503.png

 

PaigeMiller
Diamond | Level 26

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.

PaigeMiller_0-1663012019648.png

--
Paige Miller
drdrewr
Calcite | Level 5
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"!!!
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
drdrewr
Calcite | Level 5

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

 

PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
drdrewr
Calcite | Level 5
Yes, Paige. Your assumptions are right on point (I figured you would see this when you saw the data). I actually do the summarizing in an earlier PROC SQL step and end up with a summary record for each individual day and I also create another summary and table for each month. Wow!!! Yes, this is wonderful and should greatly decrease the time for me to arrive at my destination!!! I can't thank you enough for your excellent/outstanding assistance!!!
drdrewr
Calcite | Level 5
Paige, thank you. Thank you! THANK YOU!!!!!!!! It is "easy" now and PROC REPORT is no longer "out of reach" for me!!!
drdrewr
Calcite | Level 5
Also, thank you for the tip on how to properly unload my samples in the future!!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 11 replies
  • 1363 views
  • 0 likes
  • 2 in conversation