Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

Why am I getting SAS ERROR 22-322 syntax error


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your updated information shows that you have observations in your input dataset Testwyf.Varlst with empty values of LIBNAME and MEMBER. Also having a period in the value of MEMBER is probably indication that it is either a numeric variable (or does not even exist in that dataset) or was generated from a numeric variable that had a missing value. So fix your input dataset.

Sometimes the macro processor interferes with SAS's ability to parse your code into tokens for evaluation and a single token that it being built with macro code is seen as two tokens instead of one. One simple solution is to build the token into another macro variable and then use that macro variable to generate the code.

In your case make macro variables to hold the full dataset names and then use those to generate the SAS code.

%let indsn = &inLibref..&inMember.;
%let outdsn = &outLibref..&inMember.;
data &outdsn.(drop=TradingTime);
  set &indsn.(keep=Symbol ShortName TradingTime LastPrice OpenPrice);

Also protect yourself from non-standard member names.

call symputx("inMember",nliteral(memname));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...