DATA Step, Macro, Functions and more

Issue getting sysin value using RSUBMIT

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

Issue getting sysin value using RSUBMIT

 

I am trying to get the batch mode value first but it is blank so then revert to using the _SASPROGRAMFILE macro var.

 I wonder if there is a better way to handle this.

 

This happens when I submit the code using RSUBMIT

 

%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 ;

Accepted Solutions
Solution
‎12-13-2017 10:58 AM
Super User
Posts: 9,604

Re: Issue getting sysin value using RSUBMIT

Posted in reply to arpitsharma27

Sysin gives you the name of a program that was used on the commandline of a SAS batch process. When SAS is started via CONNECT, there is no such program present, so sysin (and _sasprogramfile) will be empty or nonexistent.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Super User
Posts: 13,066

Re: Issue getting sysin value using RSUBMIT

Posted in reply to arpitsharma27

Nothing is happening in what you have shown. That is only the definition of a macro. There is no indication that you have actually executed the macro or any description of running the macro. Also since there is no reference to RSUBMIT it is very hard to  even guess what the macro is supposed to do in relation to RSUBMIT.

 

To show a result it may be necessary to set options mprint symbolgen; prior to the code. Then show the results with code and messages from the log for the submission involving the macro definition, execution and the code using rsubmit.

 

It may be better to paste the log results in a code box opened with the {I} icon.

Solution
‎12-13-2017 10:58 AM
Super User
Posts: 9,604

Re: Issue getting sysin value using RSUBMIT

Posted in reply to arpitsharma27

Sysin gives you the name of a program that was used on the commandline of a SAS batch process. When SAS is started via CONNECT, there is no such program present, so sysin (and _sasprogramfile) will be empty or nonexistent.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 85 views
  • 0 likes
  • 3 in conversation