BookmarkSubscribeRSS Feed
uopsouthpaw
Calcite | Level 5

I'm working on SAS Studio and have an interesting problem.  I am doing analysis, followed by table and graph creations.  I have 2 codes set up; one for subset creation and the other for the analysis and TLG creation.  Both have macros to run everything and all I have to do is change the file name and some inputs on the macro declaration for the new data set.  I have 6 different outcomes split on 2 groups (hence 12 separate tables, graphs, then 6 overlaid graphs by group).  I needed to add a new outcome, which gets processed as the same as before.  Here is the situation:  Group A works perfectly fine.  Group B crashes my macro and kills all SAS Studio functionality.  I essentially have to close the window down and log back in to get it working again.  Besides the values being different (date bins and quantities), both group A & B are processed on the same macros.  The only real difference is the file name.  Thoughts?

 

Macro A:

creates subsets based on Outcome and Group to an Excel file.

 

Macro B:

reads in each Outcome/Group excel file, then calculates a cumulative time to event rate for the specified outcome and group.

*Outcomes 1-6, Groups A & B creates the proper output of tables and graphs.

*Outcome 7, Group A creates the proper output of tables and graphs.

*Outcome 7, Group B does diddly.  After hitting run, it pops over to the log window, but does even show warning or flags.  I cannot run another macro or process code without restarting SAS Studio.

 

FYI.  If I decide to work without Macro B and just locally declare my macro variables and process the code "manually", then I get the desired outcome.  It's just trying to do it with the macro that causes failure.  I had a situation before where my macros were crashing due to the location of an apostrophe (even though it was commented out).  My code worked perfectly before altering it to a macro, but once it was in the macro, it didn't like the apostrophe.  Obviously that's not the exact case here.

 

Any thoughts or ideas would be greatly appreciated.

 

Thanks,

 

Wes

2 REPLIES 2
ballardw
Super User

No code.

No data.

No log.

 

No answer.

 

Please provide something that might resemble actual details.

 

I would suggest if you haven't yet that you set :

OPTIONS MPRINT;

before running the macro and save the log to a text file for detailed examination.

If you can't tell what is going  wrong then post the mprint results for where the problems start appearing.

 

If you use in line comments with the *text; structure such as :

 

Data something;

    set datasource;

   * the next step does something;

<code>

;

Then you really should change every single one inside a macro  to either the /* comment */ style or the specific for macros:

%*comment;

 

Tom
Super User Tom
Super User

Most likely you are generating unbalanced quotes or something like that and it is confusing SAS.

Working with Excel files could also be a problem since they are prone to containing confusing content, but less likely if they are files you generated from SAS.

 

Make sure to turn on the MPRINT option before calling the macro so that the log will show what code the macro has generated.  You could also try turning on SYMBOLGEN or MLOGIC, but if the macro is very complex that could quickly yield a log file that too clutter with meaningless message to be useful to a human reviewer.

 

You might also try saving the code to a file and use the batch (background) submit mode in SAS/Studio so that you will get it to run in a separate session and you can then check the log of that session.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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