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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 1 reply
  • 232 views
  • 0 likes
  • 2 in conversation