BookmarkSubscribeRSS Feed
attaman2008
Calcite | Level 5
Hello, anybody knows how to check if macro variable's length exceeds max length (65534) while select into runs?
E.g.
proc sql;
select x into :y separated by " " from z;
quit;
Macro var Y is always created nevertheless its lenght, but when I'm trying to use it further it, of course, invokes an error if length is more than 65534
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You may want to explore using the DICTIONARY TABLES and SAS-maintained member/view DICTIONARY.COLUMNS to at least verify the incoming data column/variable length before proceeding with another SELECT.

Search the SAS support http://support.sas.com/ website using this Google advanced argument or with using the SAS support website search:

dictionary columns variable length site:sas.com


Scott Barry
SBBWorks, Inc.
LinusH
Tourmaline | Level 20
Since the into: construct also does an implicit COMPBL type of compress, you have to scan each value on beforehand and calculating the real length of your macro variable. If your sample code was relevant, I think a simple data step will do the job.


/Linus
Data never sleeps
DanielSantos
Barite | Level 11
Try to check the variable lenght with a CASE WHEN END statement.

proc sql;
select case when length(x) > 65534 then '' else x end into :y separated by " " from z;
quit;

Cheers from Portugal.

Daniel Santos @ www.cgd.pt

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!

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
  • 1021 views
  • 0 likes
  • 4 in conversation