2

So I have some SAS DIS jobs which create "kickout" data when run - by this I mean that if things run smoothly, none of the "kickout" data is generated, but it is known that there will be exceptions and I would like to have those exceptions put into a table and automatically emailed to me so that I am notified when something is behaving in a non-ideal manner.

I can create a transformation which will send an email containing the data I'm looking for, but the data is formatted as html and thus not in a form conducive to analysis. I'd like the transformation to email a .csv file which is more easily manipulated.

There is the option to send a .spk file but I'm having issues getting that to work and in any case am not sure it really suits my needs.

Is what I want possible, with or without the standard Publish to Email transformation provided by SAS DIS? Looking at the SAS DIS user guide I'm guessing that there is no pre-built transformation which does what I want, but can the base SAS code accomdate this requirement?

Thanks much!

Joe
  • 62,789
  • 6
  • 49
  • 67
Rookatu
  • 1,487
  • 3
  • 21
  • 50

1 Answers1

3

The "Publish to Email transformation" uses ODS HTML to generate the output so you'll get a HTML output. If you want an XLS output then there is a way. You could change the extension of the output file to xls to generate xls file from the ODS HTML. This is an old way of generating xls from ODS HTML.

Now coming to the SPK file. This is something you should look into. Since you are looking into getting an xls/csv attachement which you can open and do some manipulation etc. SPK file is like a ZIP file. You can right click and unzip spk file. Basically you can put in all your files within a archive/spk file and get that emailed as attachement using the "Publish to Email Transformation"

To get this done, go to the properties of the "Publish to Email Transformation" and Under Publishing option=>

  • select Send report in an archive (.spk) file as an email attachment in the Select viewer file/attachment option field
  • provide folder/path where the spk file would be stored under Select path of where to store archive file containing report
  • provide the name of the spk file under Specify filename of archive file containing report
  • provide name=value pair of the package under Specify one or more desired package name/value pairs for package. For example this transformation is generating a PROC PRINT of an INPUT data set and the output file is c:\sushil\test.html then enter myname=(test.html) . The myname is for labeling purpose when you unzip the spk you should get test.html

Now Under REPORT SPECIFICATION option in the "Publish to Email Transformation" transformation select "Generate PROC PRINT from input table" and then enter the path and filename of generated report which based on our previous entry should be c:\sushil\test.html

Also, to select "Generate PROC PRINT from input table" you would need to right click the "Publish to Email Transformation" and select Ports -> Add Input Port. This how you can connect a table with the transformation. Now this is the minimum settings required to generate spk package from the transformation. Let me know if it helps!!

Note: This information is as per SAS DI Studio 4.6. I don't know if the transformation is updated in the newer version of DI Studio.

sushil
  • 1,576
  • 10
  • 14
  • Hey, as always thanks for being so helpful Sushil! I'm having an issue with your first suggestion: changing the output file extension to .xls did not change the behaviour - I still just got html embedded in an email instead of an attached file. As for using the .spk, that works but requires more steps (download file from email, then unzip) and the final output is still html. Is there anyway to just have an xls or csv attached to the sent email? Thanks so much! – Rookatu May 30 '15 at 22:20
  • I'm sorry if my answer confused you. There are only 3 kinds of output that the transformation can generate: 1) email as body text[which would be HTML even if extension is changed] 2) simple text that reports have been published 3) attachment as .spk file which would have all the reports. I understand that you tried to change html to xls with 1st kind of output and that should not work since default output would be html only in email. Now this transformation cannot attach any other file except for .spk file. – sushil May 31 '15 at 10:52
  • We usually club all our reports from the job and end the job with this transformation with xls reports. We simple change the file extension from "Report specification" option to xls and under publishing option change file extension to xls in name/value pair. I'm not sure why you are still getting html. I'm not sure if you already did or not, but try and change in my example "c:\sushil\test.html" to "c:\sushil\test.xls" and myname=(test.html) to myname=(test.xls) – sushil May 31 '15 at 10:52
  • If csv file needs to added to spk then generate it before the transformation and then add the file in the name/value pairs for package. – sushil May 31 '15 at 10:53
  • Thanks sushil, this worked. I have a job which produces two emails with .spk files containing .xls reports. Are you saying I can somehow combine these two into one single Publish to Email transformation which sends both files? – Rookatu Jun 01 '15 at 15:30