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

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!

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