BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9
%Macro EDC(Type,id);
data out_table;
set RF300L3.edc_thick;
where col_ins_id = &id;
run;
%mend;

%macro Html;
ods listing close;
ods html file="/imec/other/imecweb/osp/sp/files/HTML.html" data _null_;
set all_append_and_edc_and_vars;
if type = 'THICK' then call execute('%EDC(THICK,col_ins_id)');
proc print data=out_table;run;

run;

ods html close;
%mend;
%Html;

the problem is the id i have to pass

Message was edited by: Filipvdr Message was edited by: Filipvdr
6 REPLIES 6
andreas_lds
Jade | Level 19
If "col_ins_id" is a dataset variable, then using cat can help.

[pre]call execute(cats('%EDC(THICK,' col_ins_id, ')');[/pre]
PatrickG
SAS Employee
I'm not sure I get what your problem / question is....
ballardw
Super User
> %Macro EDC(Type,id);
> data out_table;
> set RF300L3.edc_thick;
> where col_ins_id = &id;
> run;
> %mend;
>
> %macro Html;
> ods listing close;
> ods html
> file="/imec/other/imecweb/osp/sp/files/HTML.html"

Missing semicolon to end ODS HTML statement;


> data _null_;
> set all_append_and_edc_and_vars;
> if type = 'THICK' then call

This may not work as EDC calls a data step and can not nest datasteps.

> execute('%EDC(THICK,col_ins_id)');
> proc print data=out_table;run;
>
> run;
>
> ods html close;
> %mend;
> %Html;
>
> the problem is the id i have to pass
>
> Message was edited by: Filipvdr
>
> Message was edited by: Filipvdr
Filipvdr
Pyrite | Level 9
so there is no solution to do this kind of working with macro and datasets to print?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
First, the ODS statement is missing a trailing semi-colon as was mentioned.
Second, the DATA step that invokes the CALL EXECUTE must have a RUN; statement to terminate / compile the code before invoking the PROC PRINT that follows.

Recommend the OP add the SAS statement below so that the max amount of diagnostic info is generated to the SAS log, and then if there are still problems, REPLY to this post with a COPY/PASTE of the entire SAS-generated log output:

OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MPRINT /* MLOGIC */;

Also, if there are problems completing a forum post, review this companion forum post (and bookmark it for future reference) with posting guidelines:

http://support.sas.com/forums/thread.jspa?messageID=27609


Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

call execute run statement site:sas.com
Ksharp
Super User
You should add 'proc print ' into your first macro EDCT. Such as


%Macro EDC(Type,id);
data out_table;
set RF300L3.edc_thick;
where col_ins_id = &id;
run;
proc print data=out_table;run;
%mend;

%macro Html;
ods listing close;
ods html file="/imec/other/imecweb/osp/sp/files/HTML.html" data _null_;
set all_append_and_edc_and_vars;
if type = 'THICK' then call execute('%EDC(THICK,col_ins_id)');


run;

ods html close;
%mend;
%Html;



Because the code generated by call execute is executed after your data _null_;

Ksharp

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 1971 views
  • 0 likes
  • 6 in conversation