I'm trying to identify an error that doesn't prevent a table be created but is calling the attention of our error tracking script. So, every time this error is logged, I get a message about it sent by our error tracking routine.
Here is the straightforward code:
%macro createDec(var);
%local _fse1_dec10, _fse1_dec20, _fse1_dec30, _fse1_dec40, _fse1_dec50, _fse1_dec60, _fse1_dec70, _fse1_dec80, _fse1_dec90;
data tbl_out;
retain year month mvt cd_cust pub ebb fse_1 fse_2;
merge tbl_tmp0001(where=(pub = &var and mvt = &_movAnt and fse_1 ne .) in=a keep= year month mvt cd_cust ebb pub fse rename= fse=fse_1)
tbl_tmp0001(where=(mvt = &_movAtl) in=b keep= mvt cd_cust fse rename= fse=fse_2);
by cd_cust;
if a;
run;
proc univariate noprint data = tbl_out;
var fse_1;
output out=Pctls_t_3 pctlpts=10 to 90 by 10 pctlpre=decil_;
run;
proc sql noprint;
select *
into:_fse1_dec10, :_fse1_dec20, :_fse1_dec30, :_fse1_dec40, :_fse1_dec50,
:_fse1_dec60, :_fse1_dec70, :_fse1_dec80, :_fse1_dec90
from pctls_t_3;
quit;
%mend;
%createDec("0_1");
We have two global variables called _movAtl and _movAnt that represents the year and month, e.g., 202010, 202101, etc. Every time I run the script, I got the following error:
53 %createDec("0_1");
2 The SAS System 07:36 Wednesday, May 12, 2021
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
ERROR: Invalid symbolic variable name ,.
SYMBOLGEN: Macro variable VAR resolves to "0_1"
SYMBOLGEN: Macro variable _MOVANT resolves to 202010
SYMBOLGEN: Macro variable _MOVATL resolves to 202001
NOTE: There were 10465412 observations read from the data set WORK.TBL_TMP0001.
WHERE (pub='0_1') and (mvt=202010) and (fse_1 not = .);
NOTE: There were 0 observations read from the data set WORK.TBL_TMP0001.
WHERE mvt=202001;
NOTE: The data set WORK.TBL_OUT has 10465412 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 6.00 seconds
cpu time 1.82 seconds
NOTE: The data set WORK.PCTLS_T_3 has 1 observations and 9 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
real time 35.52 seconds
cpu time 10.90 seconds
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
I was unable to determine what's causing that error listed in the running log, but the table was created. Any help would be appreciated.
Thanks,
Marcio Souza
Thank you Reeza!
I haven't even noticed that there were commas between the variables. I have copied the from an email and pasted into the code.
Regards
You cannot include a comma in macro variable (aka symbol) name.
You tried to make a macro variable named: _fse1_dec10,
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: