DATA Step, Macro, Functions and more

Output records longer than 32767 bytes in SAS on UNIX?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 112
Accepted Solution

Output records longer than 32767 bytes in SAS on UNIX?

I'm creating some plain text (ASCII) records in a SAS data step.  I'm running in a UNIX/SAS 9.4/SAS EG 7.1 environment.  When I string everything together, some of these records are over 100,000 bytes long.  UNIX can handle records of that length, but as I recall (and confirmed by what testing I have so far done), SAS has a constraint of no more than 32767 bytes in an output record.

Is there some kind of workaround such that I can create output records longer than 32767 bytes?

 

Thank you,

 

Jim


Accepted Solutions
Solution
‎05-21-2017 08:32 PM
PROC Star
Posts: 7,467

Re: Output records longer than 32767 bytes in SAS on UNIX?

Posted in reply to jimbarbour

On your file statement just include the lrecl option (e.g., file the_output_filename lrecl=999999Smiley Wink

 

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Super User
Posts: 19,770

Re: Output records longer than 32767 bytes in SAS on UNIX?

[ Edited ]
Posted in reply to jimbarbour

The LRECL option doesn't override this? The docs say the maximum is 1G under Unix but I don't know what that actually means. 

 

http://support.sas.com/documentation/cdl/en/hostunx/69602/HTML/default/viewer.htm#p0upngkius4n84n17w...

 

Edit: The SAS 'constraint' is just the default value, not an actual constraint. 

Solution
‎05-21-2017 08:32 PM
PROC Star
Posts: 7,467

Re: Output records longer than 32767 bytes in SAS on UNIX?

Posted in reply to jimbarbour

On your file statement just include the lrecl option (e.g., file the_output_filename lrecl=999999Smiley Wink

 

Art, CEO, AnalystFinder.com

 

Frequent Contributor
Posts: 112

Re: Output records longer than 32767 bytes in SAS on UNIX?

[ Edited ]

Thank you to all three of you.  All three of you are right.  I'm going to mark @art297's answer as the solution since it is the most specific in terms of a fix, but all three of you deserve credit, and I thank you.

 

@LinusH, I was aware of the 32767 byte limit for a single variable.  I was confused in thinking that 32767 was a hard constraint for the the LRECL.  Simply setting a value for the LRECL parameter as suggested by @art297 took care of that (I already had multiple 32767 length character variables set up to handle the data).

 

Easiest fix.  Ever.  Thank you, again.

 

Jim

Super User
Posts: 5,424

Re: Output records longer than 32767 bytes in SAS on UNIX?

Posted in reply to jimbarbour
When you say "string together" do you mean as in one SAS variable? Then the maximum is as you say 32K.
Then the work around is not to string together but output your data from different variables.
Data never sleeps
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 201 views
  • 2 likes
  • 4 in conversation