I want use sas sql to crate a new macro:
proc sql;
select xyz into : abc separated by ',' from large_data;
quit;
to create a new macro variable,,if dataset large_data has very large observations . I am not sure how the new macro &abc can load it. and is there any option to modify the macro size to load a large size value?
Thanks
Nope. The max length of a macro variable is 65534 chars.
Very often when you encounter something like this (system limit), there are better alternatives, some even without involving macro variables. Please explain your whole picture.
The system option MVARSIZE controls the size limit of a single macro variable and allows assigning some pretty large values
You can change it using an option statement
options mvarsize=32000; would set the max size to 32000 bytes
options mvarsize-32000K; would set the max size to 32000 kilobytes.
Use M for megabyts and G for Gigabytes. The maximun number allowed in the assignement is 65534.
HOWEVER you have to pay attention to the maximum total amount of memory assigned to all macro variables which is similary controlled by the MSYMTABMAX option setting. If you use most of the memory for a single macro variable you may not be able to assign other macro variables within memory and the system will start spending a lot of time writing macro values to disk and then rereading.
But as @Haikuo mentions there are often better ways to handle things when you start bumping up against memory limits for macros.
MVARSIZE set the maximum in-memory size. The default is 4k. The maximum size for macro variables is still 64k sadly.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.