BookmarkSubscribeRSS Feed
JamesBlack
Fluorite | Level 6

Hi,

 

I have more models (HPLogistic/HPgenselect) and use CODE FILE to score data.

 

When reading this file using %include into a datastep like this:

 

DATA want;
SET have;
%include '\\sasmat\FirstHPgenSelect.sas'
%include '\\sasmat\SecondHPgenSelect.sas'
%include '\\sasmat\ThirdHPgenSelect.sas'
RUN;

following error occurres:

 

+_SKIP_000:
           _________
           305
ERROR 305-185: Label has already been used.

 

... It reads only the first %include and gives the error for all the others. It seems like the code wants to navigate to a specific location in the generated scoring code which has the same name in all these files and Sas can't handle it.

 

Any idea how to overcome this problem is highly appriciated.

 

Thanks 😉

 

___

*SAS EG version 7.15 HF3 (7.100.5.6132) (64-bit)

8 REPLIES 8
Kurt_Bremser
Super User

This looks like the code in the include files uses goto and a specific label. Within one data step, a label can appear only once. Change the goto statements and the labels in the includes so no label is used repeatedly.

It might also be that the whole scoring code is structured in a way that only one of them can be used at any time, so you might get other issues.

JamesBlack
Fluorite | Level 6
Thank you, I noticed this. I don't know how to do that without having to edit all included files separatly...

The option to be able to use only one scoring code doesn't look good to me, since I need to score quite big dataset with bunch of models...
RW9
Diamond | Level 26 RW9
Diamond | Level 26

First off, do not put %include statements in a datastep - they are not datastep components.  Second, an include statement should be finished with a semicolon.  Third, dont code in uppercase.

%include '\\sasmat\FirstHPgenSelect.sas';
%include '\\sasmat\SecondHPgenSelect.sas';
%include '\\sasmat\ThirdHPgenSelect.sas';

data want;
  set have;
run;

 

Would be more appropriate, although I suspect you have some general SAS code in those files you would want to include in your program, if so make them macros and then call the macro in the datastep, much cleaner, and you could then put them on the sasautos and not include at all.

JamesBlack
Fluorite | Level 6

To your First, it is proper technique to score data using %include in data step, see "The CODE statement". I'm aware of semicolons, I just forgot them in this sample code... I would be getting different error, if they were not in my script.
I have not noticed that SAS would be case sensitive...

 

Calling this file from a macro desn't make any difference since it doesn't change anything inside the file which causes the error.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I always advise to put setup things at the top, such as include files, macro variables, options, so it is clear where things are defined.  In this case it seems to be different, so can't speak there.  What I was getting as was to put the code within the included files a a macro and then call that, thus utilising sasautos, however again, in this instance this appears to go against the grain.

SAS itself is not case sensitive, but my eyes are.  Code is far easier to read and debug when not written in uppercase.

andreas_lds
Jade | Level 19

Renaming the label and fixing all goto statements using it is the easy way to solve this. Not using labels and goto in a data step would be my first choice.

JamesBlack
Fluorite | Level 6

Mine too, but I don't know how to do that in a simple way in one piece of code. Editing multiple prefabricated SAS codes which suppose to save my time, seems ineffective to me...

Tom
Super User Tom
Super User

Just guessing here since you didn't include full code (or log) but it looks like your separate %INCLUDE blocks are all using the same LABEL statement. 

_SKIP_000:

So you cannot use them together in the same data step.

 

Either code them to use unique labels.

Or run them as separate data steps.

Or find another way to do this that does not need labels.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 1312 views
  • 2 likes
  • 5 in conversation