BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
arpitsharma27
Calcite | Level 5

 

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 ;
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

2 REPLIES 2
ballardw
Super User

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.

Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 804 views
  • 0 likes
  • 3 in conversation