- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.