06-14-2016 04:17 PM
I want use sas sql to crate a new macro:
select xyz into : abc separated by ',' from large_data;
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?
06-14-2016 04:24 PM
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.
06-14-2016 04:39 PM - edited 06-14-2016 05:06 PM
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.
06-14-2016 05:07 PM
One thing learned.
I've been programming in SAS off and on for almost 30 years. I have never had to actually use the MVARSIZE and related options.
06-16-2016 02:34 AM - edited 06-16-2016 05:05 PM