Help using Base SAS procedures

Failing code

Reply
New Contributor YB1
New Contributor
Posts: 2

Failing code

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;

Super User
Posts: 19,789

Re: Failing code

Ok. How does it fail?

Post your code and log. 

Super User
Posts: 11,343

Re: Failing code

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?

New Contributor YB1
New Contributor
Posts: 2

Re: Failing code

[ Edited ]
/* 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. -##


Super User
Posts: 19,789

Re: Failing code

You still haven't told us what's not working.

Trusted Advisor
Posts: 1,558

Re: Failing code

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.

Respected Advisor
Posts: 4,920

Re: Failing code

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.

PG
Ask a Question
Discussion stats
  • 6 replies
  • 432 views
  • 0 likes
  • 5 in conversation