-2

I have one main program Main.sas and several sub programs.

In Main.sas, I define several macro variables.

%let startdate = ..;
%let enddate = ..;
%let path = ....;

Then I call sub programs via %include

%include "&path.\print1.sas";
Lovnlust
  • 1,507
  • 3
  • 29
  • 53
  • Show your log. Additionally, what's in plot1 would be useful. – Reeza Jan 19 '15 at 04:47
  • I don't follow what you mean about macro variables, it really helps if you provide a full working example that does''t work. You do need to make sure the macro variables are assigned before you run your code. Additionally you need to make sure you run on LOCAL rather than your server. – Reeza Jan 19 '15 at 05:47
  • 1
    This question can't be usefully answered unless it includes sufficient information to reproduce the problem, which it does not. – Joe Jan 20 '15 at 15:38

2 Answers2

0

Your %include seems fine to me. I'd be looking at your &path variable first (assuming it isn't really balabala) for something simple, but it is more likely that the problem is that you have an unbalanced statement, comment, or string in your plot1.sas. It might run fine on its own, depending on which editor you are using, and still have a problem.

See if this question on unbalanced quotes helps.

Community
  • 1
  • 1
Leo
  • 2,775
  • 27
  • 29
  • 1
    Good suggestion. Also worth noting that if you have fixed the imbalance in your code, restarting SAS may also be a good idea so that any existing imbalance is cleared. – Robert Penridge Jan 19 '15 at 16:47
0

It is a good practice to delimit macro variables with a dot when you use them as part of a larger string: %include "&path.\plot1.sas"The dot is there to let the macro facility know that the name of the macro variable ends at the character "h" of "path".

As Robert points out, use options source2; to see the code submitted by the include statement.

If the above do not help, please post your plot1.sas code, it may have an unbalanced quote or similar issue as Leo suggests.

jaamor
  • 317
  • 3
  • 15
  • 2
    It's good practice to make code readable. Delimit macro variables if it is either required or makes the code more readable. `options mprint` does not show the code submitted by the include, that particular behaviour belongs to `options source` and `options source2`. – Robert Penridge Jan 19 '15 at 16:45