BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

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

5 REPLIES 5
Haikuo
Onyx | Level 15

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.

ballardw
Super User

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.

Haikuo
Onyx | Level 15

@ballardw ,

 

One thing learned.

 

Thanks!

Haikuo

ballardw
Super User

@Haikuo wrote:

@ballardw ,

 

One thing learned.

 

Thanks!

Haikuo


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.

ChrisNZ
Tourmaline | Level 20

@ballardw

 

MVARSIZE set the maximum in-memory size. The default is 4k. The maximum size for macro variables is still 64k sadly.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 6134 views
  • 0 likes
  • 4 in conversation