BookmarkSubscribeRSS Feed
EVN
Calcite | Level 5 EVN
Calcite | Level 5
Hi! Is there a way to determine the maximum record length of a dataset?

I ask because I am running into an issue where I am exporting a dataset to MS Access 2003 and, with some of the records, the last few variables are dropping. I think it is due to the total record length being more than ~2000 characters for those records. I then have to remove some variables and execute the PROC EXPORT again (which works well after removing the variables).
4 REPLIES 4
Patrick
Opal | Level 21
Hi

Something like the (untested) code below might do.

proc sql;
select length(cats(of _all_)) as rec_length
from
having max(length(cats(of _all_))) = length(cats(of _all_))
/* having length(cats(of _all_)) > 2000 */
;
quit;

HTH
Patrick
EVN
Calcite | Level 5 EVN
Calcite | Level 5
Admittedly, I'm a newby with SAS so I am not sure how to apply your code. Given the below example, how would I apply your code? I would anticipate the answer to be 16 (the longest record. Thanks!

data test;
input var1 var2 $5-17;
datalines;
123 abcdef
234 babcdefghij
3455 abcdefghijff
;
Cynthia_sas
SAS Super FREQ
Hi:
That number will be the max length of the number of characters needed for a single observation, but do remember that when the data are stored in a SAS dataset, there is some overhead to how the dataset is organized because of the "header" information that SAS stores. This Tech Support note illustrates the complexity involved when trying to calculate the number of "pages" needed to store the data set on disk.
http://support.sas.com/kb/24/723.html

cynthia
Ksharp
Super User
I am not sure .The dictionary tables in PROC SQL have a variable
obslen num label='Observation Length' which you maybe need.But the record length i got is 24.

[pre]
proc sql feedback;
describe table dictionary.tables ;
quit;



data test;
input var1 var2 $5-17;
datalines;
123 abcdef
234 babcdefghij
3455 abcdefghijff
;
proc sql;
select memname,obslen
from dictionary.tables
where libname='WORK' and memname='TEST';
quit;
[/pre]



Ksharp Message was edited by: Ksharp

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!

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