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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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