BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MyleneC
Calcite | Level 5

How long is the length of the value that can be put in a macro variable?

Here is my code:

    /** Get specific title from the note description dataset **/

    proc sql noprint; 

      select desc_e, desc_f into :T1_EI_TITLE_E, :T1_EI_TITLE_F

      from notedesc.no&curr_nt 

      where code = "T1_EI_TITLE";

    quit;

It crashes because the length of both "desc_e" and "desc_f" is too long.  Is there a way to make this work?

Thanks a lot in advance 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
MyleneC
Calcite | Level 5

You were right...  it was a semi column issue.  Thanks everyone!!

View solution in original post

3 REPLIES 3
Astounding
PROC Star

The most common setting for maximum length of a macro variable is 65,534 characters.  Do you really expect the values you are reading to be anywhere near that long?  More likely there is some other cause of the crash.  Have you considered reading the data into a SAS data set rather than into macro variables?

Good luck.

MyleneC
Calcite | Level 5

You were right...  it was a semi column issue.  Thanks everyone!!

ballardw
Super User

If there is a "crash" do you mean errors in the log or SAS quits? If there are errors then post them to help diagnose the problems.

The system option MVARSIZE sets the maximum length of macro variables and may default to 4096.

Try

proc options group=macro; run;

to examine macro related settings.

If the lengths of your data set variable do exceed the MVARSIZE then increase the value:

options mvarsize=9000; or sum such to match.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 3 replies
  • 2925 views
  • 1 like
  • 3 in conversation