DATA Step, Macro, Functions and more

ERROR: Expecting an arithmetic expression.

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

ERROR: Expecting an arithmetic expression.

Can anyone help to look what wrong with the program below?

I keep getting error message like

ERROR 386-185: Expecting an arithmetic expression.

ERROR 76-322: Syntax error, statement will be ignored.

ERROR 202-322: The option or parameter is not recognized and will be ignored.


data try;
     input var1 var2 var3;
     datalines;
     7 2 2
     5 5 3
     7 2 7
;
%macro test;   %let tt=try;
data try2;
     set try;
     %bquote(dsid)=open(%str(%')&tt%str(%'));
     if varnum(%bquote(dsid),'var4') = 0 then var4 = .;
run;

%mend;
%test;

Thansk a lot!!


Accepted Solutions
Solution
‎02-19-2013 03:43 PM
Super User
Posts: 5,497

Re: ERROR: Expecting an arithmetic expression.

Posted in reply to lizhehong

Then this should make your life much easier.  Switch to double quotes ... it's %str that is causing the problem:

dsid = open("&tt");

View solution in original post


All Replies
Super User
Posts: 5,497

Re: ERROR: Expecting an arithmetic expression.

Posted in reply to lizhehong

First, you have to realize that %bquote does nothing in your program.  The quoted version of the letters "dsid" is still "dsid".  Second, it is highly suspicious that you are trying to open a data set that is already open because it is mentioned in the SET statement.  What would you get if you tried this program, eliminating the confusion caused by adding macro language?

data try2;

set try;

dsid = open('try');

run;

The results may answer your other questions.

Good luck.

New Contributor
Posts: 3

Re: ERROR: Expecting an arithmetic expression.

Posted in reply to Astounding

Thank you Astounding! this is just part of my program. I have to put a macro variable in open('&dat'). 

Solution
‎02-19-2013 03:43 PM
Super User
Posts: 5,497

Re: ERROR: Expecting an arithmetic expression.

Posted in reply to lizhehong

Then this should make your life much easier.  Switch to double quotes ... it's %str that is causing the problem:

dsid = open("&tt");

New Contributor
Posts: 3

Re: ERROR: Expecting an arithmetic expression.

Posted in reply to Astounding

The issue is solved.  I thought I have to use single quote in it :smileyblush: Thank you so much!!!!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 4352 views
  • 0 likes
  • 2 in conversation