BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I´m trying to write a variable about 1000 chars long to a file, but i don´t seem to get more than the first 384 characters written to the file. I´m farely new to SAS - i´ve tried reading the documentation but i can´t seem to find the solution. If anyone knows what i´m doing wrong or if this actually is a limitation, please help me. .

As an example, the following snippet is only displaying 384 of the expected 400 chars.

Kind regards,

filename thefile catalog 'work.SCMR.testing.source' lrecl=32767;
data _null_;
file thefile lrecl=32767 LINESIZE=10000;
length test $ 32767;
test = '****************************************************************************************************' !!
'1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' !!
'2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222' !!
'****************************************************************************************************';
put test;
run;
3 REPLIES 3
data_null__
Jade | Level 19
From my test of your code it is working fine. I even made TEST longer and the notes show that all bytes in TEST are written.

When you write
> As an example, the following snippet is only
> displaying 384 of the expected 400 chars.
how do you determine that only 384 chars are DISPLAYING?

[pre]
121 filename thefile catalog 'work.SCMR.testing.source' lrecl=32767;
122 data _null_;
123 file thefile lrecl=32767 LINESIZE=10000;
124 length test $ 32767;
125 test =
125! '*******************************************************************************************
125! *********' !!
126 '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
126! 111111111' !!
127 '2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
127! 222222222' !!
128 '*******************************************************************************************
128! *********';
129 test = cats(test,test,test,test,test,test);
130 put test;
131 run;

NOTE: The file THEFILE is:
(system-specific pathname),
(system-specific file attributes)

NOTE: 1 record was written to the file (system-specific pathname).
The minimum record length was 2400.
The maximum record length was 2400.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


132
133 data _null_;
134 infile thefile lrecl=32767 LINESIZE=10000;
135 input;
136 list;
137 run;

NOTE: The infile THEFILE is:
(system-specific pathname),
(system-specific file attributes)

RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
1 ***************************************************************************************
88 *************11111111111111111111111111111111111111111111111111111111111111111111111111
175 111111111111111111111111112222222222222222222222222222222222222222222222222222222222222
262 222222222222222222222222222222222222222************************************************
349 ***************************************************************************************
436 *****************************************************************1111111111111111111111
523 111111111111111111111111111111111111111111111111111111111111111111111111111111222222222
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
610 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
697 2222***********************************************************************************
784 ***************************************************************************************
871 ******************************111111111111111111111111111111111111111111111111111111111
958 111111111111111111111111111111111111111111122222222222222222222222222222222222222222222
1045 22222222222222222222222222222222222222222222222222222222*******************************
1132 ***************************************************************************************
1219 **********************************************************************************11111
1306 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
1393 111111112222222222222222222222222222222222222222222222222222222222222222222222222222222
1480 222222222222222222222******************************************************************
1567 ***************************************************************************************
1654 ***********************************************1111111111111111111111111111111111111111
1741 111111111111111111111111111111111111111111111111111111111111222222222222222222222222222
1828 2222222222222222222222222222222222222222222222222222222222222222222222222**************
1915 ***************************************************************************************
2002 ***************************************************************************************
2089 ************111111111111111111111111111111111111111111111111111111111111111111111111111
2176 111111111111111111111111122222222222222222222222222222222222222222222222222222222222222
2263 22222222222222222222222222222222222222*************************************************
2350 *************************************************** 2400
NOTE: 1 record was read from the infile (system-specific pathname).
The minimum record length was 2400.
The maximum record length was 2400.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds


[/pre]
Cynthia_sas
SAS Super FREQ
Hi:
Are you writing to an existing partitioned data set (catalog) on the mainframe??? In some instances, for some types of PDS, you might be bound the the LRECL that was defined when the PDS was created. The example from DATA _NULL_ shows that you can write quite a large file. My suggestion would be to try to write to a single, non-catalog, non-PDS file and see whether you run into the same issue. Otherwise, your best resource for this question might be to work with Tech Support. To open a track with Tech Support, go to:
http://support.sas.com/ctx/supportform/createForm

cynthia

PS...the SAS LINESIZE (such as for the output window has a limit of 256, but that is not the same as the limit for the LINESIZE option on the FILE statement.
From the doc:

Default: The default LINESIZE= value is determined by one of two options:
the LINESIZE= system option when you write to a file that contains carriage-control characters or to the SAS log.

the LRECL= option in the FILE statement when you write to a file.

Range: From 64 to the maximum logical record length that is allowed in your operating environment.
Operating Environment Information: The highest value allowed for LINESIZE= is dependent on your operating environment. For details, see the SAS documentation for your operating environment.
)
deleted_user
Not applicable
Hi,

Thanks for the answer, it got me wondering about what actually is displayed vs. the real content of the file and: the file contains the correct data but sas base (SAS 9.1.3 SP 4) only displays the first 384 chars. When opening the sas base file in ultraedit i can see that everything is correct. Should have thought of that possibility myself before posting, but thanks again!

/Peder And yes, when writing to a file instead the output looks ok. Thanks for the quick response.


Message was edited by: pfrohm

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
  • 1214 views
  • 0 likes
  • 3 in conversation