BookmarkSubscribeRSS Feed
Scottcom4
Calcite | Level 5
Good Afternoon,

I have recently stumbled over using the Spool Option in tandem with the Include statement which would assist in reducing the amount of code I have. An example of what I have is below.

OPTIONS SPOOL;

DATA TEST;
SET SASHELP.CLNMSG;
WHERE LEVEL = "N";
RUN;

DATA TEST1;
%INC 4:5;
RUN;

It appears very simpe, but I get nothing in dataset TEST1.

Does anyone have an idea about what I am doing wrong? I have trawled the internet, but can't find anything of use.

Your help is greatly appreciated.

Regards,
Scott
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
Here's the doc:
http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000218370.htm

The difference between your example and the example in the doc is that they do not show the included code from one data step program inside a second (different) data step program. You might wish to work with Tech Support on this question.

cynthia
data_null__
Jade | Level 19
Run your program in BATCH. It appears that %INC line numbers is not supported in Windows DMS where I tested it. As I recall INCing line number ranges was originally for interactive line mode SAS sessions, where it is a sort of poor mans recall.

It also appears that interactive line mode is not supported in windows os.

[pre]
NOTE: This session is executing on the WIN_PRO platform.



NOTE: SAS 9.1.3 Service Pack 4

NOTE: SAS initialization used:
real time 0.25 seconds
cpu time 0.09 seconds

1 OPTIONS SPOOL;
2
3 DATA TEST;
4 SET SASHELP.CLNMSG;
5 WHERE LEVEL = "N";
6 RUN;

NOTE: There were 160 observations read from the data set SASHELP.CLNMSG.
WHERE LEVEL='N';
NOTE: The data set WORK.TEST has 160 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds


7
8 DATA TEST1;
9 %inc 4:5 / source2;
NOTE: %INCLUDE (level 1) previous line numbers.
10 +SET SASHELP.CLNMSG;
11 +WHERE LEVEL = "N";
NOTE: %INCLUDE (level 1) ending.
12 RUN;

NOTE: There were 160 observations read from the data set SASHELP.CLNMSG.
WHERE LEVEL='N';
NOTE: The data set WORK.TEST1 has 160 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


2 The SAS System 06:07 Thursday, September 10, 2009

1 OPTIONS SPOOL;
2
3 DATA TEST;
4 SET SASHELP.CLNMSG;
5 WHERE LEVEL = "N";
6 RUN;
7
8 DATA TEST1;
9 %inc 4:5 / source2;
10 SET SASHELP.CLNMSG;
11 WHERE LEVEL = "N";
12 RUN;
13
14 %list 1:20;
13
14 %list 1:20;

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 0.26 seconds
cpu time 0.10 seconds
[/pre]

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 18127 views
  • 0 likes
  • 3 in conversation