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:
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.
*SAS EG version 7.15 HF3 (220.127.116.1132) (64-bit)
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.
Thursday - last edited Thursday
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.
Thursday - last edited Thursday
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.
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.
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.
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...
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.
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.