Hi, i have a problem with the dimension definiton of an array. My code works good in SAS Guide, but in the bash does't works.
The macro variables nvars and obs are definited as:
data _null_;
set sashelp.vtable (where= (memname='ABT_DUMMY'));
call symput('nvars', nvar-1);
call symput('obs', nobs);
run;
I wish to put the macros in array dimension:
data bt_lambda (keep= var dot);
array xx[&nvars.] x_1-x_&nvars.;
array xd[&obs., &nvars.] _temporary_;
run;
But return the errors:
The code works if i defined the macros as:
%let nvars=23;
%let obs=84000;
But i need the dynamical dimension. Someone can tell me a solution?
The log shows that "nvars" is -1 not 23. Using call symputx is recommended, so that blanks are automatically stripped from the macro-variable.
The log shows that "nvars" is -1 not 23. Using call symputx is recommended, so that blanks are automatically stripped from the macro-variable.
First of all, use CALL SYMPUTX instead of CALL SYMPUT. SYMPUTX strips leading and trailing blanks.
It looks as if your dataset does not contain any variables (resulting in nvars being -1, which is an invalid dimension for the array).
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.