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!!!!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.