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

Hi Dear,

I am writting a SAS dataset to a file. Accourding to my coding , it doesn't write the 2nd and continues records properly in the output file.  when I put recfm=v, it does write properly on file. Can any one tell the reason for this. or Am I doing right if put recfm=v?

  

LIBNAME SWXTEST 'C:\mylib\MAY2011';

FILENAME SWXTEST1 'C:\v_sas_mytest.txt' ;

DATA _NULL_;

file swxtest1 LRECL=4046 RECFM=F ;

set swxtest.v_sas_temp(obs=100);

PUT @    1          APPID                                                   8.   

         @    9          APPTITLE                                             $100.    

         @  109          ORIGINBRANCHID                               $6.    

         @  115          ORIGINOFFICERID                              $1.    

         @  116          PRIBORTYPE                                      $1.    

         @  117          PRIBORID                                            8.    

         @  125          INSTANTRESP                                     $1.    

         @  126          DATEAPPENTRYSTART            datetime20.    

         @  146          PERSONNELID                                    8.    

         @  154          APPLICATIONSOURCE                        $20.    

         @  174          FRSTNAM                                            $15.    

         @  189          LSTNAME                                            $25.    

         @  214          EMPLOYNUM                                       8.    

         @  222          ATTACHREQ                                      $3.    

         @  225          APPLICATIONTYPE                            $4000.    

         @ 4225          SWXVAILABLEREVOLVINGCREDIT    10.2    

         @ 4235          SWXRETURNEDTOBRANCH              $1.    

         @ 4236          SWXTOTALCREDITSTOCONNECTIONS  10.2    

         @ 4246          SWXCONNECTEDBUSINESSCREDIT    10.2   ;

          run;

Thanks very much in advance

Antony

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

If you are expecting 100 records with CR/LFs at the end of each record, remove the recfm= option. I.e., use:

file swxtest1 LRECL=4057;

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

First a question: what does it do when you specify an lrecl that is as large as the record you are trying to write?

You specify 4046 but then try to write a record that is at least 4255 characters wide.

Inp
Obsidian | Level 7 Inp
Obsidian | Level 7

Thanks Arthur.

It is my typo. I tried with 4255 with the record lenght as well and put the recfm=f.  but the problem is it is writting the second record very far. It is not write 2nd record at the 4256 column. or row after 4256 column.

thanks

Anton

art297
Opal | Level 21

If you are expecting 100 records with CR/LFs at the end of each record, remove the recfm= option. I.e., use:

file swxtest1 LRECL=4057;

Inp
Obsidian | Level 7 Inp
Obsidian | Level 7

Thanks very much Arthur. It resolved my problem.

Antony

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1443 views
  • 0 likes
  • 2 in conversation