i have a table that looks like this
id. Date. Code
A1. 02/01/15. OOC
A2. 02/01/2015. OOC
A3. 02/03/15. DB
A4. 02/04/15. DB
I want create a pivot table in sas looking like this
02/01/15. 02/03/15. 02/04/15
OOC. 2.
DB. 1. 1
then I would like it if I can add the pivot table to the body of outlook
Hi:
A pivot table is an Excel data structure. Do you want to embed an Excel pivot table in Outlook mail or do you just want a SAS report or a table that you can email to someone. Your desired output looks like a report that could easily be produced with either PROC REPORT or PROC TABULATE. But the SAS Report will not be an Excel pivot table. There is an ODS destination that will make a pivot table, but it does so by putting JavaScript into an HTML file. And, some mail programs do not allow script elements in the mail for security reasons. Although SAS mail capability would allow you to mail an attachment as part of a mail.
Otherwise, to embed a Microsoft data structure in a Microsoft mail product would seem to call for Microsoft technology.
cynthia
Hi Cynthia,
your correct i came up with a proc report does exactly that ...now the question how I would be able export that to the body of outlook to be able to email it out ... I have the code to auto email already I would like to know how attach the html output named report which resides in results... I'm playing around with ods but any help would be greatly appreciated
Reeza,
i Have a code so alter to this it creates the report in results but when it runs the output section it doesn't pick it up
any thoughts what I'm mmight be missing?
FILENAME output EMAIL
SUBJECT= "Sales summary report 1" FROM= "bob@sas.com"
TO= "charlie@sas.com" CT= "text/html" /* Required for HTML output */ ;
ODS HTML BODY=output STYLE=sasweb; TITLE JUSTIFY=left
"Total Sales by Country and Product type as of %sysfunc(date(),yymmdd10.)";
PROC REPORT DATA=sashelp.prdsale NOWD STYLE(REPORT)=[PREHTML="<hr>"] /*Inserts a rule between title & body*/; COLUMNS COUNTRY PRODTYPE,ACTUAL; DEFINE COUNTRY /GROUP; DEFINE PRODTYPE /ACROSS; DEFINE ACTUAL/SUM ""; BREAK AFTER PRODTYPE /SUMMARIZE;
RUN; ODS HTML CLOSE;
PROC REPORT DATA=sashelp.prdsale NOWD STYLE(REPORT)=[PREHTML="<hr>"] /*Inserts a rule between title & body*/; COLUMNS COUNTRY PRODTYPE,ACTUAL; DEFINE COUNTRY /GROUP; DEFINE PRODTYPE /ACROSS; DEFINE ACTUAL/SUM ""; BREAK AFTER PRODTYPE /SUMMary
it didn't copy correctly here is rest of code... I need for results to be added to body of outlook like a pic
Hi:
Since many mail systems do not allow HTML mail these days, I generally use the method shown in this paper:http://support.sas.com/resources/papers/proceedings11/300-2011.pdf starting on page 7. I send my ODS files as attachments. That always works very reliably for me. That way I don't have to worry about whether the mail system allows HTML or RTF or PDF format mail or not. If you continue to have issues, you might want to open a track with Tech Support, there are many settings that can only be done at start up that have to be turned on before mail from SAS will work and depending on your OS and your mail client, you may not have the right things set for sending mail no matter which method you use.
cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.