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

I'm trying to use a macro to make a drill down graph. For part of this, I have the following code:

ods listing close;
goptions reset=global gunit=pct htitle=6 htext=4 ftitle=zapfb ftext=swiss;
goptions device = gif transparency noborder;
ods html body 'covid.html' path=odsout;

%LET SVI1=Very Low Vulnerability;
%LET SVI2=Low Vulnerability;
%LET SVI3=Moderate Vulnerability;
%LET SVI4=High Vulnerability;
%LET SVI5=Very High Vulnerability;

%macro means;
%do n=1 to 5;
ods html body="vuln&n..html" path=odsout;
proc means data=covid2 min q1 mean median q3 max;
var prop_vax;
where SVI="&&svi&n";
title "Proportion Vaccinated in Counties with &&svi&n";
%end;
quit;
%mend;

However, whenever I try to run the macro it provides with a blank vuln1.html file and a vuln5.html file that contains graphs for both svi4 and svi5. I don't know what is going on and why it doesn't want to print the first table in the first file it creates. For some reason it waits until the following file. Can someone explain what is wrong with this code?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Where are your ODS HTML Close statements?

 

If you are going to attempt macro programming you will want to make sure that every Procedure has a RUN at the end and that you matching open/closes for thing like Ods destinations.

 

You should also show how/where call the macro as code before and after may make a difference.

 

If you add:

Options mprint;

before where you call your macro you can see in the log more details of the code as generated.

Use Options nomprint; to turn this off.

Then look in your generated code for where things like RUN and close should be.

View solution in original post

1 REPLY 1
ballardw
Super User

Where are your ODS HTML Close statements?

 

If you are going to attempt macro programming you will want to make sure that every Procedure has a RUN at the end and that you matching open/closes for thing like Ods destinations.

 

You should also show how/where call the macro as code before and after may make a difference.

 

If you add:

Options mprint;

before where you call your macro you can see in the log more details of the code as generated.

Use Options nomprint; to turn this off.

Then look in your generated code for where things like RUN and close should be.

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!

Autotuning Deep Learning Models Using SAS

Follow along as SAS’ Robert Blanchard explains three aspects of autotuning in a deep learning context: globalized search, localized search and an in parallel method using SAS.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1031 views
  • 0 likes
  • 2 in conversation