BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
mudassir786
Calcite | Level 5

Hi All,

Im downloading a file from a Server location and then attaching the file in SAS Email code. Is there any solution for attaching file directly from server ie: giving server path in attachment. when i try to give server path it says physical file doesn't exist.

currently below code is working.

 

options mprint symbolgen;

 

/*report name*/

%let report_ext =AMSHPP.EC654350.EASTOPEN;

 

/*paths*/

%let serverfl = /var/data/devel/serial/freight/znative/private/mbg/mbg_batch/main;

%let sas_local_path = /opt/production/znative_sas/SAS_CODES/tmp/MBG_SAS/Email_Files;

 

**output file --lst file;

filename mylst sftp "&serverfl/&report_ext" host="10.193.18.29" USER='dp1201770';

filename saslst "&sas_local_path/&report_ext";

 

data _null_;

infile mylst;

file saslst;

input;

put _infile_;

run;

 

                                            

       filename outbox  email

         TO=(abc@gmail.com

              FROM=('abinitio2linux_emailer@gmail.com')

        ATTACH=("%sysfunc(pathname(saslst))")     /*how can i give the server path here*/                       

        SUBJECT='Requests stuck in a non-final Status';            

                                                                        

      data _null_;                                                     

        file outbox;                                                   

        PUT 'The file is generated with pending data in the attachment';                    

      run;                                                             

  

data _null_;

rc=fdelete('saslst');

run;

1 ACCEPTED SOLUTION

Accepted Solutions
jklaverstijn
Rhodochrosite | Level 12

Hi,

 

The ATTACH= option to the EMAIL filename statement is documented as

 

specifies the physical name of the file or files to be attached to the message

 This implies that it has to be a locally accessible file. So your current approach of copying the file seems to be proper. Wish I had better news.

 

Hope this helps,

- Jan.

View solution in original post

1 REPLY 1
jklaverstijn
Rhodochrosite | Level 12

Hi,

 

The ATTACH= option to the EMAIL filename statement is documented as

 

specifies the physical name of the file or files to be attached to the message

 This implies that it has to be a locally accessible file. So your current approach of copying the file seems to be proper. Wish I had better news.

 

Hope this helps,

- Jan.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 415 views
  • 0 likes
  • 2 in conversation