create table work.OUTP2 as
select * , 'BLANK' as Completion_Status,
'BLANK COMPLETION STATUS' as ERROR_MESSAGE
from &_INPUT1 (drop=Completion_Status)
where Completion_status_no=0 ;
quit;
Ok. How does it fail?
Post your code and log.
Other than not seeing a Proc SQL; at the start
what is the value of &_input1? Does it actually match an existing data set?
Does that data set actually have any records where Completion_status_no=0?
/* ADM.HRSC.TRNG.TR.Fully */
%if (&_COST_OBJECT eq ADM.HRSC.TRNG.TR.Fully) %then
%do;
proc sql;
create table &_OUTPUT1 as
select distinct COST_OBJECT,
BUSINESS_LINE_CODE,
BUSINESS_LINE,
NEW_DIER_CODE,
'ADM.HR' as SourceDIER,
'# of Training Classes' as DriverName,
sum(Completion_status_no) as VOLUME,
Location
from &_INPUT1
where Completion_status_no=1
group by
COST_OBJECT,
BUSINESS_LINE_CODE,
BUSINESS_LINE,
NEW_DIER_CODE, Location;
create table work.OUTP2 as
select * , 'BLANK' as Completion_Status,
'BLANK COMPLETION STATUS' as ERROR_MESSAGE
from &_INPUT1 (drop=Completion_Status)
where Completion_status_no=0
quit;
%end;
##- Please type your reply above this line. Simple formatting, no
attachments. -##
You still haven't told us what's not working.
The code is part of a macro program.
The problem could be somewhere else in the macro.
Better show the whole code and the log.
Create global macro variables such as
%let _INPUT1=MYDS;
and test the SQL or DATA steps outside of your macro. You should be able to pinpoint the troublesome step by checking the log. If every step works as intended, then the problem is with macro logic.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.