Desktop productivity for business analysts and programmers

Export & Retrieve data for emailing across Servers

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

Export & Retrieve data for emailing across Servers

Hi Forum,

 

The title is the best description I could think of so I'll describe the issue.

 

Before my time, someone had created a clever method of exporting the results of an EG project to a files server location.

 

In the code there is a line such as;

 

&tmp\reports\oct17\report_results;

The &tmp part is setup somewhere to represent the first part of the UNC path & the rest is the path to the Files folder on the Server.

 

 

After the files are stored there, the code then retrieves it to attach to an email.

 

I haven't seen this setup before & no-one who created it is left to explain it.

 

Can someone help me understand how this works or point me towards some articles books?

 

Thanks  


Accepted Solutions
Solution
‎11-04-2017 10:47 PM
Respected Advisor
Posts: 4,783

Re: Export & Retrieve data for emailing across Servers

Posted in reply to OscarBoots2

@OscarBoots2

 ....have you seen an example of a variable being used to replace part of a directory path?

Yes, that's quite common, i.e. for implementation of code in a DEV environment which then gets moved to PROD. I'd normally use a macro variable for all root paths so that no code changes between environments are required (i.e. for a change from LEV3 to LEV1).

 

I also want to understand where this info is located.

That totally depends on your actual code. But yes, the macro variable must get created somewhere. &TMP feels like done in your code using either a %LET statement or CALL SYMPUT(). EG also has an option to define code in an EG project to be run when you create a new session - check your SAS log right after connecting to an application server.

 

I want to follow how to export the EG Project results to the Server File Folder

EG is your client. The code gets executed on the server so the results get directly written from the SAS server to the folder location (and that's also the reason why you can't write results to your local C-drive as this drive is not accessible from the Server side).

View solution in original post


All Replies
Respected Advisor
Posts: 4,783

Re: Export & Retrieve data for emailing across Servers

Posted in reply to OscarBoots2

@OscarBoots2

Not sure which part you don't understand but in a nutshell:

SAS EG is your client connecting to a SAS server. Execution happens on the server side so you need to thing from the server side. 

 

It appears you SAS process (server side) first creates some files and stores them somewhere on disk, then the process has another step where it sends "stuff" to an email server for execution (SAS takes here the role of the email client).

 

Many sites have all the connection configuration for the email server already done. You can get what has been defined via:

proc options group=email;
run;

If everything is defined and working (ports open) then it's simply about writing correct SAS syntax so SAS sends the necessary information to the mail server. This syntax is fully documented. I've done a quick Google search...

site:support.sas.com 9.4 email

...and got links like:

http://documentation.sas.com/?docsetId=hostunx&docsetTarget=p1hl3t66coao7bn18vrmhx2gte1q.htm&docsetV...

http://support.sas.com/kb/19/767.html

 

 

Contributor
Posts: 60

Re: Export & Retrieve data for emailing across Servers

Thanks Patrick,

 

That's very useful, have you seen an example of a variable being used to replace part of a directory path?

 

I also want to understand where this info is located.

 

Normally there would be a %let Statement to pass the string value of the variable but this '&tmp' value must be stored somewhere else.

 

I want to follow how to export the EG Project results to the Server File Folder for later retrieval & emailing.

 

Thanks again. 

Solution
‎11-04-2017 10:47 PM
Respected Advisor
Posts: 4,783

Re: Export & Retrieve data for emailing across Servers

Posted in reply to OscarBoots2

@OscarBoots2

 ....have you seen an example of a variable being used to replace part of a directory path?

Yes, that's quite common, i.e. for implementation of code in a DEV environment which then gets moved to PROD. I'd normally use a macro variable for all root paths so that no code changes between environments are required (i.e. for a change from LEV3 to LEV1).

 

I also want to understand where this info is located.

That totally depends on your actual code. But yes, the macro variable must get created somewhere. &TMP feels like done in your code using either a %LET statement or CALL SYMPUT(). EG also has an option to define code in an EG project to be run when you create a new session - check your SAS log right after connecting to an application server.

 

I want to follow how to export the EG Project results to the Server File Folder

EG is your client. The code gets executed on the server so the results get directly written from the SAS server to the folder location (and that's also the reason why you can't write results to your local C-drive as this drive is not accessible from the Server side).

Contributor
Posts: 60

Re: Export & Retrieve data for emailing across Servers

Thanks Patrick,

 

I understand this better now, thank you.

 

I need to see where the &tmp variable path is eet as it isn't done anywhere I can see.

 

There's no %Let or Symput statement or anything stored under Tools >> Options >> SAS Programs 

 

Thanks for your help. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 205 views
  • 0 likes
  • 2 in conversation