BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10
data _null_;
filename mail email 
to=(&mv_email_destinataire_list) 
from="SAS"		
subject="Export file";
file mail;
put "hello, please find enclosed the file";
PUT "link= \\\ukipu004.dummy-website.fr\cdg\Export_files\result.xls";
run;

 

Hello,

by launching this code, it works. I mean, in the reveived email, by clicking on the link, the file is found and opened.

however I 've got a unix variable $GRPFPU that contains ukipu004.dummy-website.fr\cdg

so I try to launch with this line ==>PUT "link= \\\$GRPFPU\Export_files\result.xls";

but the email contains \\\$GRPFPU\Export_files\result.xls instead of \\\ukipu004.dummy-website.fr\cdg\Export_files\result.xls then this link doesn't work.

thanks a lot in adavance for your help


Nasser

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

UNIX environment variables are not automatically imported into SAS. Exceptions: environment variables that contain a path to a directory or to a file are automatically used as librefs or filerefs, respectively.

 

To create a macro variable from a UNIX environment variable, use the %sysget() function:

data _null_;
filename mail email 
to=(&mv_email_destinataire_list) 
from="SAS"		
subject="Export file";
file mail;
put "hello, please find enclosed the file";
PUT "link= \\\%sysget(GRPFPU)\Export_files\result.xls";
run;

To be more specific, I'd incorporate the protocol and proper UNIX-style syntax:

put "link= https://%sysget(GRPFPU)/Export_files/result.xls";

Replace https with whatever you're using to access the file.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

UNIX environment variables are not automatically imported into SAS. Exceptions: environment variables that contain a path to a directory or to a file are automatically used as librefs or filerefs, respectively.

 

To create a macro variable from a UNIX environment variable, use the %sysget() function:

data _null_;
filename mail email 
to=(&mv_email_destinataire_list) 
from="SAS"		
subject="Export file";
file mail;
put "hello, please find enclosed the file";
PUT "link= \\\%sysget(GRPFPU)\Export_files\result.xls";
run;

To be more specific, I'd incorporate the protocol and proper UNIX-style syntax:

put "link= https://%sysget(GRPFPU)/Export_files/result.xls";

Replace https with whatever you're using to access the file.

Nasser_DRMCP
Lapis Lazuli | Level 10

thnaks a mot Kurt. It works as attended. evenf if the link is a littl weird with "\" and "/" like this :

lien= \\\/ukipu004.dummy-website.fr\folst\Export_files\result.xls

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
  • 2 replies
  • 680 views
  • 1 like
  • 2 in conversation