BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hi, all:

 

I saw several codes written from previous programmer.  Could someone let me know what they are refering to? Thanks.

 

Y

 

%including "file-specification"/source2;

%rename (uned., _3);

 

%including "file-specification"/source2;

%state (uned., _4);

 

%including "file-specification"/source2;

%report (uned., _5);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16
It is one way of using the macro calls (sas programs) which are located in some location and you want to use them in your current program.

%include is used to refer to the location where the macro program is located and source2 causes the SAS log to show the source statements that are being included in your SAS program.

%rename is the macro call which is being referred in the %include statement.

But i wonder why the %include statemnet has the sas program name as _3_rename.sas and %macro call name is %rename I am expecting the %include should refer to the rename.sas programs file.
Thanks,
Jag

View solution in original post

8 REPLIES 8
ybz12003
Rhodochrosite | Level 12

I specify the %including code:

 

%including "\\test\_3_rename.sas"/source2;

%rename (uned., _3);

 

%including "\\test\_4_state.sas"/source2;

%state (uned., _4);

 

%including "\\test\_5_report.sas"/source2;

%report (uned., _5);

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I don't think that is the exact code is it.  The first:

%including "file-specification"/source2;

Is not correct, correct syntax is:

%include "file-specification" / source2;

 

This loads the given text file and inserts the text at the point of include.

 

The other three are calls to user built macros.  As I am not on your system, can't see any of it, I cannot state anything other than that.

ybz12003
Rhodochrosite | Level 12

Yes.  I apologize my typo.  It's %include.

Kurt_Bremser
Super User

You should post the real code you have questions about. "%including" is not valid SAS syntax.

 

That said, %include tells SAS to fetch the file and place its contents where the %include was.

The other lines seem to call macros from those files.

Jagadishkatam
Amethyst | Level 16
It is one way of using the macro calls (sas programs) which are located in some location and you want to use them in your current program.

%include is used to refer to the location where the macro program is located and source2 causes the SAS log to show the source statements that are being included in your SAS program.

%rename is the macro call which is being referred in the %include statement.

But i wonder why the %include statemnet has the sas program name as _3_rename.sas and %macro call name is %rename I am expecting the %include should refer to the rename.sas programs file.
Thanks,
Jag
ballardw
Super User

@Jagadishkatam wrote:
But i wonder why the %include statemnet has the sas program name as _3_rename.sas and %macro call name is %rename I am expecting the %include should refer to the rename.sas programs file.

@Jagadishkatam I've seen file naming conventions like that when they were used to indicate the Order that scipts or programs should be run. I'm not saying it's a good practice but I've seen that.

ybz12003
Rhodochrosite | Level 12

Hi,

 

If %rename is the macro call which is being referred in the %include statement.  It shouldn't be use semicolom, it should be just

 

%rename

 

Am I right?

Jagadishkatam
Amethyst | Level 16
you can always call macro calls either with or without semicolon
Thanks,
Jag

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!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1513 views
  • 4 likes
  • 5 in conversation