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!!
Then this should make your life much easier. Switch to double quotes ... it's %str that is causing the problem:
dsid = open("&tt");
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.
Thank you Astounding! this is just part of my program. I have to put a macro variable in open('&dat').
Then this should make your life much easier. Switch to double quotes ... it's %str that is causing the problem:
dsid = open("&tt");
The issue is solved. I thought I have to use single quote in it :smileyblush: Thank you so much!!!!
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.