Hi ALL,
I am trying to use the below code to export my log from SAS Enterprise Guide 6.1 to a specified location based on the program name?
So basically i want to find out the program name so that i can put the below code in the SAS enterprise guide
Option->sas programs ->Additional sas code ->Insert custom SAS code before submitted code
We have a grid environment, where we are using a Linux server to execute the code and frontend is SAS EG 6.1
%let Name = TEST1;
%let pgm_name = /* need help here */;
%let today= %sysfunc(putn(%sysfunc(today()),yymmddn8.));
proc printto log = "/sas/develop/admin/&name./dev/logs/&pgm_name._&today..txt" new;
run;
i have tried many ways, but could not find any for doing this in interactive mode.
Thanks in Advance,
Manjeet
%macro pgmname() ;
%local retval ;
%let retval = %sysfunc( getoption( sysin ) ) ; /* batch mode */
%if %isblank( &retval. ) %then %let retval = &_SASPROGRAMFILE ; /* interactive mode */
/* next line removes single quotes produced in interactive mode */
%qsysfunc( compress( &retval., %str(%') ) )
%mend ;
What????
@tbellmer_wf wrote:
...
/* next line removes single quotes produced in interactive mode */
%qsysfunc( compress( &retval., %str(%') ) )
...
Why would you want to remove ALL of the quotes from a string? Wouldn't that make any string that includes quotes invalid?
Are you trying to remove the outer quotes around the string?
%qsysfunc(dequote(&retval.))
@error_prone - you are right, the &_SASPROGRAMFILE variable doesn't exist in SAS Eg interactive mode. We have to search for other options.
Thanks for the help!
Afaik no variable holding the program-name exists. The variable _ClientProjectPath has name and path of the EG-project. If you are using macros SysMacroName has the name of macro being executed, there could be a function returning the path of the macro. Can't verify this right now.
%let x=%sysget(sas_execfilename);
%let y=%sysget(sas_execfilepath);
%put &x ;
%put &y ;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.