0

I'm trying to upload a local .xls/.xlsx file to SAS using Proc Upload. Although the code seams to work and the file uploads, when i download it again to my desktop and open it... it fails as currupt!

rsubmit;
Proc Upload
  infile="C:\Users\Admin\Desktop\Book1.xls"
  outfile='Book1.xls';
run;
endrsubmit;

SAS Version: 9.3 64-bit MS Office: 2010 32-bit OS: Windows 7 64-bit

What i'm trying to acheive is... upload the file to the server, attach it to email and send and then delete is from the server.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • 1
    Try adding `BINARY` to the `PROC UPLOAD` statement, after the `outfile=` option, but before the semicolon. – mjsqu Mar 31 '14 at 07:59
  • Although the file has uploaded, when sent via email is is currupt! /* rsubmit; filename outmail email subject=%unquote(%str(%'Cars &date%')) TO= ("email") CC= ("email") attach=("cars &date..xlsx"); DATA _NULL_; FILE outmail; PUT "Hello All,"; PUT " "; PUT %unquote(%str(%'Please find attached the Cars report for &date%')); PUT " "; PUT "Regards"; PUT "J"; PUT " "; RUN; */ – user3442162 Mar 31 '14 at 09:19
  • Try `attach=("cars &date..xlsx" ct="application/octet-stream");`. If the `application/octet-stream` doesn't work, use one of the codes referenced in this SO question: [link](http://stackoverflow.com/questions/2937465/what-is-correct-content-type-for-excel-files) – mjsqu Mar 31 '14 at 09:22
  • How could you suggest deleating the file SAS server once, the email is sent and file is no longer required? – user3442162 Mar 31 '14 at 09:47
  • Google "sas file delete" and look at the first link, a page describing the `FDELETE` function. – mjsqu Mar 31 '14 at 10:03

0 Answers0