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

Hi,

 

I’m using SAS OnDemand for Academics to teach SAS programming.

As I prepare to teach SAS Macros, I noticed that the MPRINT option does not seem to take effect. Even after including OPTIONS MPRINT; in my code, the macro-generated code is not appearing in the log window.

I'm trying to determine whether MPRINT is simply not supported in this environment, or if there's a way to enforce or activate it properly within SAS OnDemand.

Has anyone encountered this issue or found a workaround?

Thank you in advance!


James

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

No need to exit SAS/Studio.  Just uses the Reset SAS Session (F9) option from "hamburger" icon.

View solution in original post

4 REPLIES 4
AhmedAl_Attar
Ammonite | Level 13

@jjyang20 

I just tried and worked!

129        OPTIONS
 130        FULLSTIMER /* Writes all available system performance statistics to the SAS log */
 131        SORTEQUALS /* Controls how PROC SORT orders observations with identical BY values in the output data set */
 132        OBS=MAX    /* Specifies when to stop processing observations or records */
 133        MSGLEVEL=I /* Controls the level of detail in messages that are written to the SAS log */
 134        SPOOL      /* Controls whether SAS writes SAS statements to a utility data set in the WORK data library */
 135        NOSYNTAXCHECK/* Does not enable syntax check mode for statements that are submitted within a */
 136        /* non-interactive or batch SAS session.       */
 137        COMAMID=TCP/* Identifies the communications access method for connecting a client and a server across */
 138        /* a network */
 139        AUTOSIGNON/* Automatically signs on to the server when the client issues a remote submit request */
 140        /* for server processing.                      */
 141        VALIDVARNAME=ANY  /* Allows the use of column names that contain embedded spaces and special characters */
 142        NOTES
 143        /*SOURCE
 144        SOURCE2*/
 145        MPRINT
 146        DEBUG=DBMS_SELECT/* shows only the select statements generated */
 147        sastrace=',,t,dsab' /* Display a summary of all generated SQL code, any threaded read/write operations, */
 148        /* and timing summary & details. */
 149        sastraceloc=saslog
 150        nostsuffix
 151        DLCREATEDIR /* Specifies to create a directory for the SAS library that is named in a LIBNAME statement */
 152        /* if the directory does not exist. */
 153        ;


69         %util_parseScaproc(p_inScaprocFileName=%str(&g_logsRoot/sca__analyze.txt)
 70         , p_outDotFilePath=%str(&g_outputRoot)
 71         , p_outDotFileName=analyze.dot
 72         , p_outDsName=work.analyze
 73         , p_includeAttrs_yn=Y, p_includeSteps_yn=Y, p_rankDir=LR)
 L_SCAPROCFILENAME=sca__analyze.txt L_SCAPROCFOLDERNAME=/home/anawarehousing/dotMySASProgram/logs/
 MPRINT(UTIL_PARSESCAPROC):   DATA work.scadata;
 MPRINT(UTIL_PARSESCAPROC):   INFILE "/home/anawarehousing/dotMySASProgram/logs/sca__analyze.txt" LRECL=1000 LENGTH=linelength 
 truncover END=eof;
 MPRINT(UTIL_PARSESCAPROC):   LENGTH scaline $1000 linenum step 5;
 MPRINT(UTIL_PARSESCAPROC):   INPUT @;
 MPRINT(UTIL_PARSESCAPROC):   INPUT scaline $varying1000. linelength;
 MPRINT(UTIL_PARSESCAPROC):   linenum+1;
 MPRINT(UTIL_PARSESCAPROC):   if (_n_=1 OR index(scaline,'STEP SOURCE FOLLOWS')) then step+1 ;
 MPRINT(UTIL_PARSESCAPROC):   RUN;

 

 

JackieJ_SAS
SAS Employee

As others have mentioned, the MPRINT option does work on ODA. You can prove it to yourself by starting a fresh SAS Studio session (exit out of ODA, then come back in) and running a simple macro program. For example, you could run this program:

options mprint;

%macro mac1;
proc print data=sashelp.cars(obs=10);
run;
%mend;

%mac1;

For your existing code- perhaps you have unbalanced quotation marks or your macro function did not correctly complete when being defined? In both those cases, SAS gets into a situation where any additional code is run as if inside a text string or inside a macro definition. There is no universal way to get out of those situations. Instead, you should exit out of ODA, restart SAS Studio, then fix your code.

Tom
Super User Tom
Super User

No need to exit SAS/Studio.  Just uses the Reset SAS Session (F9) option from "hamburger" icon.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 883 views
  • 2 likes
  • 5 in conversation