BookmarkSubscribeRSS Feed
BETO
Fluorite | Level 6

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

6 REPLIES 6
Cynthia_sas
SAS Super FREQ

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

BETO
Fluorite | Level 6

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

BETO
Fluorite | Level 6

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; 

BETO
Fluorite | Level 6

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

Cynthia_sas
SAS Super FREQ


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-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 6 replies
  • 10064 views
  • 3 likes
  • 3 in conversation