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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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