Hi!
Is it possible to use only a portion of the code call with %include in Z/OS.
For example, we have a SAS program containing 500 lines and we would like to include this program but wer'e only interested in the code between line 117 and 228.
Thank you.
@JoeQcSas wrote:
Hi!
Is it possible to use only a portion of the code call with %include in Z/OS.
For example, we have a SAS program containing 500 lines and we would like to include this program but wer'e only interested in the code between line 117 and 228.
Thank you.
No but can use a tiny data step that you could make into a macro.
filename FT15F001 temp;
filename FT44F001 temp;
data _null_;
infile FT15F001 firstobs=2 obs=3;
file FT44F001;
input;
put _infile_;
parmcards4;
*this is line 1;
*Line 2
line 3;
page;
;;;;
%inc FT44F001 / source2;
50 filename FT15F001 temp;
51 filename FT44F001 temp;
52 data _null_;
53 infile FT15F001 firstobs=2 obs=3;
54 file FT44F001;
55 input;
56 put _infile_;
57 parmcards4;
62 ;;;;
NOTE: The infile FT15F001 is:
(system-specific pathname),
(system-specific file attributes)
NOTE: The file FT44F001 is:
(system-specific pathname),
(system-specific file attributes)
NOTE: 2 records were read from the infile (system-specific pathname).
The minimum record length was 7.
The maximum record length was 7.
NOTE: 2 records were written to the file (system-specific pathname).
The minimum record length was 7.
The maximum record length was 7.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
63
64 %inc FT44F001 / source2;
NOTE: %INCLUDE (level 1) file FT44F001 is (system-specific pathname).
65 +*Line 2
66 +line 3;
NOTE: %INCLUDE (level 1) ending.
No. As the SAS Documentation states:
Restriction | You cannot selectively include lines from an external file. |
You can however include lines selectively that were previously entered in the same SAS program
@JoeQcSas wrote:
Hi!
Is it possible to use only a portion of the code call with %include in Z/OS.
For example, we have a SAS program containing 500 lines and we would like to include this program but wer'e only interested in the code between line 117 and 228.
Thank you.
No but can use a tiny data step that you could make into a macro.
filename FT15F001 temp;
filename FT44F001 temp;
data _null_;
infile FT15F001 firstobs=2 obs=3;
file FT44F001;
input;
put _infile_;
parmcards4;
*this is line 1;
*Line 2
line 3;
page;
;;;;
%inc FT44F001 / source2;
50 filename FT15F001 temp;
51 filename FT44F001 temp;
52 data _null_;
53 infile FT15F001 firstobs=2 obs=3;
54 file FT44F001;
55 input;
56 put _infile_;
57 parmcards4;
62 ;;;;
NOTE: The infile FT15F001 is:
(system-specific pathname),
(system-specific file attributes)
NOTE: The file FT44F001 is:
(system-specific pathname),
(system-specific file attributes)
NOTE: 2 records were read from the infile (system-specific pathname).
The minimum record length was 7.
The maximum record length was 7.
NOTE: 2 records were written to the file (system-specific pathname).
The minimum record length was 7.
The maximum record length was 7.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
63
64 %inc FT44F001 / source2;
NOTE: %INCLUDE (level 1) file FT44F001 is (system-specific pathname).
65 +*Line 2
66 +line 3;
NOTE: %INCLUDE (level 1) ending.
I always couldn't get it, why SAS has to pair "parmcards4" with an obscure device name such as "FT15F001"? It would be nice if SAS can remove this kind of restriction, so programmers don't have to remember or look it up in docs of version 8 and just come up some generic names they like.
@Haikuo wrote:
I always couldn't get it, why SAS has to pair "parmcards4" with an obscure device name such as "FT15F001"? It would be nice if SAS can remove this kind of restriction, so programmers don't have to remember or look it up in docs of version 8 and just come up some generic names they like.
Hi @Haikuo
The name FT15F001 is the default and can be changed. The file does not have to be temporary.
Back when there was only mainframe FT11F001 and FT12F001 were LOG and LST respectively. I can't remember if there were other unit numbers used.
PARMCARDS is fully documented in the most current SAS documentation. This excerpt is in reference to the SAS system option PARMCARDS.
Syntax
PARMCARDS=file-ref
Syntax Description
file-ref
specifies the file reference to open.
Details
The PARMCARDS= system option specifies the file reference of a file that SAS opens when it encounters a PARMCARDS (or PARMCARDS4) statement in a procedure.
SAS writes all data lines after the PARMCARDS (or PARMCARDS4) statement to the file until it encounters a delimiter line of either one or four semicolons. The file is then closed and made available to the procedure to read. There is no parsing or macro expansion of the data lines.
Thank you for the explanation. I will let others be aware of the system option.
@Haikuo wrote:
I will let others be aware of the system option.
Do you use PARMCARDS often? I don't and thought I was the only one who uses it ever. (but I never say ever -:)
We do, John. We do SAS tutorials/presentations for clients, and this comes in handy in terms of simulating input files (stream) with their contents exposed the same screen.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.