Hello!
Finding proc report syntax to be a bit tricky. I am attempting to count a variable (below - I am attempting to count the caseid variable so that I have the number of cases in each employee's queue) and add it to the summary line. I couldn't come up with a way to just display the count of the caseid variable in the summary line without also creating a column for it. The summary line also the includes the count of the days variable, which I do not need and would prefer to exclude. Is there a better way to be doing this?
This is my current code:
proc report nowd data=test;
column employee caseid n days ;
define employee/ group ;
define n / "count";
break after caseid / summarize Ol UL;
rbreak after /summarize;
run;
This is the current output:
Employee | CaseID | Count | Days |
Michael Smith | 1234-55 | 5 | |
1256-99 | 7 | ||
Michael Smith | 2 | 12 | |
Jane Doe | 7890-10 | 1 | |
2233-55 | 2 | ||
6789-12 | 4 | ||
Jane Doe | 3 | 7 |
I was hoping more for this - days is not including in the summary line and ideally (though not as crucial) count of cases would be hidden as a column.
Employee | CaseID | Days |
Michael Smith | 1234-55 | 5 |
1256-99 | 7 | |
Michael Smith | 2 | |
Jane Doe | 7890-10 | 1 |
2233-55 | 2 | |
6789-12 | 7 | |
Jane Doe | 3 |
Hi:
What you describe is possible, but will take a COMPUTE block to accomplish. Since you did not supply any data, I used some fake data and I think the report you want is the #3 report shown below:
Some of your options (like OL and UL) did not make sense for ODS destinations because those are LISTING only options. Also, I put the text "Total Cases" on the last RBREAK row to make it clear what the number was under the CASEID cell. Most of the changes happen in the COMPUTE block for days.
Cynthia
Hi:
What you describe is possible, but will take a COMPUTE block to accomplish. Since you did not supply any data, I used some fake data and I think the report you want is the #3 report shown below:
Some of your options (like OL and UL) did not make sense for ODS destinations because those are LISTING only options. Also, I put the text "Total Cases" on the last RBREAK row to make it clear what the number was under the CASEID cell. Most of the changes happen in the COMPUTE block for days.
Cynthia
Thank you for providing the three different examples. Table 3 is exactly what I was looking to do, but having the other two examples with respective code helps me understand the proc report syntax a little more. I had attempted to use COMPUTE block at some point (in my trials and tribulations) but this paints a picture of just how dynamic COMPUTE can be. Thank you!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.