<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading data from SAS7BDAT FILE and converting it into txt file issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950557#M371725</link>
    <description>yep I am getting the same output ,but the MIN rec length and MAX  is same&lt;BR /&gt;NOTE: 11 records were written to the file '$CURRPATH/YGRT010.txt'.&lt;BR /&gt;      The minimum record length was 2119.&lt;BR /&gt;      The maximum record length was 2119.&lt;BR /&gt;NOTE: There were 11 observations read from the data set WORKDIR.RPLPRNLN010_FINAL.&lt;BR /&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.</description>
    <pubDate>Wed, 13 Nov 2024 14:59:04 GMT</pubDate>
    <dc:creator>animesh123</dc:creator>
    <dc:date>2024-11-13T14:59:04Z</dc:date>
    <item>
      <title>Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950492#M371696</link>
      <description>&lt;P&gt;So I am trying to write the below code into txt file using the below format from SAS7BDAT file,&lt;/P&gt;
&lt;P&gt;But the output I am getting is not in the correct format as expected (Like this I have 120 variable which i am trying to convert in to txt file)&lt;/P&gt;
&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET workdir.RPLPRNLN010;&lt;BR /&gt;FILE '$CURRPATH/NGRT.txt';&lt;BR /&gt;put @0001 CUST_NB $16 ; &lt;BR /&gt;put @0017 PCE_OFFR_DT 10 ;&lt;BR /&gt;put @0027 PCE_OFFR_SQNC_NB 2 ;&lt;/P&gt;
&lt;P&gt;put @0029 PCE_ORIG_BRANCH_CD $2 ;&lt;BR /&gt;put @0031 PCE_CO_BUS_CD $2 ;&lt;BR /&gt;put @0033 PCE_ACCT_NB $11 ; &lt;BR /&gt;put @0037 LAST_NM $40 ; &lt;BR /&gt;put @0077 FIRST_NM $15 ;&lt;BR /&gt;put @0092 MDDL_INTL_NM $4;&lt;BR /&gt;put @0093 GNRT_NM $5 ; &lt;BR /&gt;put @0098 BIRTH_DT $10 ; &lt;BR /&gt;put @0108 ADDR_LINE1_TX $40 ; &lt;BR /&gt;put @0148 ADDR_LINE2_TX $40 ;&lt;BR /&gt;put @0188 CITY_NM $30&lt;BR /&gt;put @0218 ST_ABBR_CD $5 ;&lt;BR /&gt;put @0223 ZIP_CD $11 ; &lt;BR /&gt;put @0235 CMMRCL_IN $1 ;&lt;BR /&gt;put @0236 ECR_REJ_IN $1 ;&lt;BR /&gt;put @0237 REPO_IN $1 ;&lt;BR /&gt;put @0238 APPLCNT_CD $2 ; &lt;BR /&gt;put @0240 ACCT_CD $2 ;&lt;BR /&gt;put @0242 DECIS_CD $1 ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the ouput is&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 446px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102113i13B6CA49FB1709BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 19:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950492#M371696</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-12T19:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950493#M371697</link>
      <description>&lt;P&gt;Use only&amp;nbsp;&lt;U&gt;one&lt;/U&gt; PUT statement with all variables in it. Each single PUT will cause a linebreak (unless you use the @ modifier).&lt;/P&gt;
&lt;P&gt;Maxim&amp;nbsp;&lt;STRONG&gt;1&lt;/STRONG&gt;: Read the Documentation!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 19:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950493#M371697</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-12T19:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950504#M371698</link>
      <description>&lt;P&gt;Each put statement will write to a new line unless you instruct it via the&amp;nbsp;@ to not do so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below two syntax options that will work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* option 1 */
put @0001 CUST_NB $16. @ ;
put @0017 PCE_OFFR_DT 10. @ ;
...

/* options 2 */
put @0001 CUST_NB $16.
    @0017 PCE_OFFR_DT 10.
    ...
    ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also ensure that you end formats with a full stop.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1731443936219.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102118iDD40AFB855436CAB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1731443936219.png" alt="Patrick_0-1731443936219.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And of course use the correct format. Based on name PCE OFFR_DT looks like a variable containing a SAS Date value and though you want likely to use a SAS Date format in order to write a human readable date value to a text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 20:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950504#M371698</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-11-12T20:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950507#M371699</link>
      <description>&lt;P&gt;The "random" single characters you are seeing are because your "formats" for writing do not have a dot ending them.&lt;/P&gt;
&lt;P&gt;As mentioned the PUT writes one line for each PUT encountered unless the @ to hold a line for output is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The * you see may also be caused by incorrect format for a variable. Does your log show any statement(s) similar to:&lt;/P&gt;
&lt;PRE&gt;WARNING: Variable XXXXXX has already been defined as numeric.
&lt;/PRE&gt;
&lt;P&gt;That would occur for any numeric variable that you have attempted to use a character, $, format with.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 21:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950507#M371699</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-12T21:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950515#M371700</link>
      <description>&lt;P&gt;So you have an existing SAS dataset and you want to generate a fixed position text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your PUT statements are wrong.&amp;nbsp; You don't really need more than one PUT statement.&amp;nbsp; If you do use more than one PUT statement then you need to code all but the last one with a trailing&amp;nbsp;@ sign so that the line is not written too early.&amp;nbsp; The format specification needs to include a period so the SAS parser can distinguish them from other things like variable names or numbers.&amp;nbsp; You don't need all the leading zeros in the column positions you have with the&amp;nbsp;@ cursor movement commands, but they don't hurt anything.&amp;nbsp; It does not make sense to write 4 characters for the middle initial and then immediately overwrite all but the first character with the grant number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set workdir.rplprnln010;
  file '$currpath/NGRT.txt';
  put
   @0001 cust_nb $16. 
   @0017 pce_offr_dt 10. 
   @0027 pce_offr_sqnc_nb 2. 
   @0029 pce_orig_branch_cd $2. 
   @0031 pce_co_bus_cd $2. 
   @0033 pce_acct_nb $4.  /* From 33 thru 36 is only 4 characters */ 
   @0037 last_nm $40.
   @0077 first_nm $15. 
   @0092 mddl_intl_nm $1. /* Only room for 1 character */
   @0093 gnrt_nm $5.
   @0098 birth_dt $10.
   @0108 addr_line1_tx $40. 
   @0148 addr_line2_tx $40. 
   @0188 city_nm $30.
   @0218 st_abbr_cd $5. 
   @0223 zip_cd $11.   /* Why are you skipping a column here? */
   @0235 cmmrcl_in $1.
   @0236 ecr_rej_in $1. 
   @0237 repo_in $1. 
   @0238 applcnt_cd $2. 
   @0240 acct_cd $2. 
   @0242 decis_cd $1. 
  ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if you don't actually need to skip any columns then you don't need the&amp;nbsp;@ cursor movement commands at all since you have supplied a format for each value being written.&amp;nbsp; You could always use the + cursor movement command to skip some columns if you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set workdir.rplprnln010;
  file '$currpath/NGRT.txt';
  put
    cust_nb $16. 
    pce_offr_dt 10. 
    pce_offr_sqnc_nb 2. 
    pce_orig_branch_cd $2. 
    pce_co_bus_cd $2. 
    pce_acct_nb $4.  /* From 33 thru 36 is only 4 characters */ 
    last_nm $40.
    first_nm $15. 
    mddl_intl_nm $1. /* Only room for 1 character */
    gnrt_nm $5.
    birth_dt $10.
    addr_line1_tx $40. 
    addr_line2_tx $40. 
    city_nm $30.
    st_abbr_cd $5. 
    zip_cd $11. +1  /* Why are you skipping a column here? */
    cmmrcl_in $1.
    ecr_rej_in $1. 
    repo_in $1. 
    applcnt_cd $2. 
    acct_cd $2. 
    decis_cd $1. 
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And since ZIP_CD is character you could just print it with $12. format and eliminate the +1 cursor command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note it is not clear what your photograph is an image of.&amp;nbsp; What are the thin vertical lines? Note that a text file is made up of text so no need to go to the trouble of taking a picture of it to share.&amp;nbsp; You can just copy and paste a few of the lines from the file into the pop-up window that the Insert Code button creates.&amp;nbsp; That is the way to share text that do not want to be reflowed by this forum into paragraphs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 00:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950515#M371700</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-13T00:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950524#M371704</link>
      <description>&lt;P&gt;Hi Thanks for your quick response&lt;/P&gt;
&lt;P&gt;I have tried with the updated code that works fine&lt;/P&gt;
&lt;P&gt;Reading data from SAS7BDAT FILE and converting it into txt file&lt;/P&gt;
&lt;P&gt;Issue -But the obs count has increased from read 10 obs and writing it to 22 obs&lt;/P&gt;
&lt;P&gt;Here the sample output:&lt;/P&gt;
&lt;P&gt;-&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CAP.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102121iF73F05BC617C18A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="CAP.PNG" alt="CAP.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 12:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950524#M371704</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-13T12:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950527#M371705</link>
      <description>Show your code and log for this execution.</description>
      <pubDate>Wed, 13 Nov 2024 08:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950527#M371705</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-11-13T08:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950536#M371711</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Thanks for your quick response&lt;/P&gt;
&lt;P&gt;I have tried with the updated code that works fine&lt;/P&gt;
&lt;P&gt;Reading data from SAS7BDAT FILE and converting it into txt file&lt;/P&gt;
&lt;P&gt;Issue -But the obs count has increased from read 10 obs and writing it to 22 obs&lt;/P&gt;
&lt;P&gt;Here the sample output:-&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CAP.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102121iF73F05BC617C18A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CAP.PNG" alt="CAP.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your picture does not show anywhere near 22 obs. So how do you come to that conclusion.&lt;/P&gt;
&lt;P&gt;Note: Variables may contain line feed, carriage return or vertical tab characters that when written to text appear to be new lines. Those are not "observations" but the side effect of how a program displaying text treats those characters.&lt;/P&gt;
&lt;P&gt;Also if your line is long enough some of the programs displaying text will wrap the lines to fit a window or specified line length depending on program. Creating an illusion of more "obs".&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 10:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950536#M371711</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-13T10:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950538#M371712</link>
      <description>&lt;P&gt;A text file does not have observations, only lines. "Observation" is used for a single record in a SAS dataset.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;show the log&lt;/LI&gt;
&lt;LI&gt;show the file&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Copy/paste the &lt;U&gt;text&lt;/U&gt; of both into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that you need to open the text file with a suitable text editor (e.g. Notepad++) for this.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 10:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950538#M371712</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-13T10:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950539#M371713</link>
      <description>&lt;P&gt;Also note that some of your numbers are too big for the formats, causing asterisks or scientific notation to be written to the file.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 11:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950539#M371713</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-13T11:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950544#M371716</link>
      <description>&lt;P&gt;Hard to tell what you are talking about.&amp;nbsp; If you want to see what is in which column of the generated text file read it back in with SAS and use the LIST statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile"$currpath/NGRT.txt";
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to show us what you find copy and paste the text from the SAS log.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 12:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950544#M371716</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-13T12:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950547#M371719</link>
      <description>&lt;P&gt;Yes , In here there is only one obs ,the file is large so i cant share or show he file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When am I writing the Put statement as per Tom stated( this is for 100 variable)&lt;/P&gt;
&lt;P&gt;I can process all the&amp;nbsp; obs as you can see here&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: 11 records were written to the file '$CURRPATH/YGRT010.txt'.&lt;BR /&gt;NOTE: There were 11 observations read from the data set WORKDIR.RPLPRNLN010.&lt;/P&gt;
&lt;P&gt;But when its writing the obs into txt file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the snippit the obs are not coming in the same line as it has been defined using put&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead the line are getting busted&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 13:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950547#M371719</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-13T13:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950549#M371721</link>
      <description>Yes , In here there is only one obs ,the file is large so i cant share or show he file &lt;BR /&gt;&lt;BR /&gt;When am I writing the Put statement as per Tom stated( this is for 100 variable)&lt;BR /&gt;&lt;BR /&gt;I can process all the  obs as you can see here &lt;BR /&gt;&lt;BR /&gt;NOTE: 11 records were written to the file '$CURRPATH/YGRT010.txt'.&lt;BR /&gt;NOTE: There were 11 observations read from the data set WORKDIR.RPLPRNLN010.&lt;BR /&gt;&lt;BR /&gt;But when its writing the obs into txt file &lt;BR /&gt;&lt;BR /&gt;In the snippit the obs are not coming in the same line as it has been defined using put &lt;BR /&gt;&lt;BR /&gt;instead the line are getting busted</description>
      <pubDate>Wed, 13 Nov 2024 13:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950549#M371721</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-13T13:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950550#M371722</link>
      <description>&lt;P&gt;This is the sample code for writing it to txt file all the carriage return and line feed are fixed&lt;/P&gt;
&lt;P&gt;66 DATA _NULL_;&lt;BR /&gt;67 SET workdir.RPLPRNLN010;&lt;BR /&gt;68 FILE '$CURRPATH/YGRT010.txt' lrecl=2120 recfm=D;&lt;BR /&gt;69 put&lt;BR /&gt;70 @0001 cust_NB $16.&lt;BR /&gt;71 @0017 PCE_OFFR_DT 10.&lt;BR /&gt;72 @0027 PCE_OFFR_SQNC_NB 2.&lt;BR /&gt;73 @0029 PCE_ORIG_BRANCH_CD $2.&lt;BR /&gt;74 @0031 PCE_CO_BUS_CD 2.&lt;BR /&gt;75 @0033 PCE_ACCT_NB 11.&lt;BR /&gt;76 @0037 LAST_NM $40.&lt;BR /&gt;77 @0077 FIRST_NM $15.&lt;BR /&gt;78 @0092 MDDL_INTL_NM $4.&lt;BR /&gt;79 @0093 GNRT_NM $5.&lt;BR /&gt;80 @0098 BIRTH_DT $10.&lt;BR /&gt;81 @0108 ADDR_LINE1_TX $40.&lt;BR /&gt;82 @0148 ADDR_LINE2_TX $40.&lt;BR /&gt;83 @0188 CITY_NM $30.&lt;BR /&gt;84 @0218 ST_ABBR_CD $5.&lt;BR /&gt;85 @0223 ZIP_CD $11.&lt;BR /&gt;86 @0234 BNKRP_IN $1.&lt;BR /&gt;87 @0235 CMMRCL_IN $1.&lt;BR /&gt;88 @0236 ECR_REJ_IN $1.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;alos there is ** is coming inthe output not sure why?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 13:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950550#M371722</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-13T13:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950555#M371724</link>
      <description>&lt;P&gt;The asterisks will appear when you use formatted printing when the numeric value is invalid for the format specification used.&amp;nbsp; For example there is no way to represent values larger than 99 with only two digits.&amp;nbsp; So if you print 123 using 2. format you will get **.&amp;nbsp; And you will get a note in the log about it.&amp;nbsp; Example:&lt;/P&gt;
&lt;PRE&gt;368  data _null_;
369    x=123;
370    put x 2.;
371  run;

**
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;In addition to the two notes you posted that show the number of observations read and lines written you should also see notes about how long the shortest and longest line was.&amp;nbsp; Example:&lt;/P&gt;
&lt;PRE&gt;345  data _null_;
346    file text;
347    set sashelp.class;
348    put name sex age ;
349  run;

NOTE: The file TEXT is:
      Filename=xxx,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=13Nov2024:09:19:56,
      Create Time=13Nov2024:09:19:56

NOTE: 19 records were written to the file TEXT.
      The minimum record length was 9.
      The maximum record length was 12.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.03 seconds
&lt;/PRE&gt;
&lt;P&gt;Notice&lt;/P&gt;
&lt;PRE&gt;      The minimum record length was 9.
      The maximum record length was 12.&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;How are you LOOKING at the text file?&amp;nbsp;&lt;/STRONG&gt; Since you are writing lines that over 200 bytes long if you just type the file to a terminal the lines will wrap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try reading it with SAS?&amp;nbsp; Again note that SAS will display in the log the min and max lengths of the lines read from the file in addition to the number of lines.&amp;nbsp; Did SAS find 11 lines when it read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are only two ways a single PUT statement (without / or # cursor motion commands) could write more than one line.&amp;nbsp; Either the text being written includes line breaks.&amp;nbsp; In that case you will only notice the difference when you read back in the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or the lines being written are longer than the record length being used by the FILE statement which will cause the PUT statement to move to a new line.&amp;nbsp; But that case you will see a different number of lines written than observations read when checking the LOG from the data step that wrote the file.&lt;/P&gt;
&lt;PRE&gt;363  data _null_;
364    file text lrecl=30;
365    set sashelp.class(obs=3);
366    put name sex @35 age ;
367  run;

NOTE: The file TEXT is:
      Filename=xxx,
      RECFM=V,LRECL=30,File Size (bytes)=0,
      Last Modified=13Nov2024:09:31:02,
      Create Time=13Nov2024:09:31:02

NOTE: 6 records were written to the file TEXT.
      The minimum record length was 2.
      The maximum record length was 9.
NOTE: There were 3 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 14:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950555#M371724</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-13T14:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950557#M371725</link>
      <description>yep I am getting the same output ,but the MIN rec length and MAX  is same&lt;BR /&gt;NOTE: 11 records were written to the file '$CURRPATH/YGRT010.txt'.&lt;BR /&gt;      The minimum record length was 2119.&lt;BR /&gt;      The maximum record length was 2119.&lt;BR /&gt;NOTE: There were 11 observations read from the data set WORKDIR.RPLPRNLN010_FINAL.&lt;BR /&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.</description>
      <pubDate>Wed, 13 Nov 2024 14:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950557#M371725</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-13T14:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from SAS7BDAT FILE and converting it into txt file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950562#M371726</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;alos there is ** is coming inthe output not sure why?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you provide a numeric format that is not wide enough to display the actual value SAS will display&amp;nbsp; *. Generally will also attempt to use a BEST format but if the width you provided is too small still can't display.&lt;/P&gt;
&lt;P&gt;An example:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x=123456;
   file print;
   put "Format 2. result: " x = 2.;
   put "Format 4. result: " x = 4.;
   put "Format 6. result: " x = 6.;
   put "Format Best4. result: " x = Best4.;
run;&lt;/PRE&gt;
&lt;P&gt;Which generates a result of:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE summary="Page Layout" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;PRE class="batch"&gt;                                                                                                  
Format 2. result: x=**                                                                            
Format 4. result: x=12E4                                                                          
Format 6. result: x=123456                                                                        
Format Best4. result: x=12E4                                                                      &lt;/PRE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that the LOG tells of this problem. My log from running the above code:&lt;/P&gt;
&lt;PRE&gt;8    data _null_;
9       x=123456;
10      file print;
11      put "Format 2. result: " x = 2.;
12      put "Format 4. result: " x = 4.;
13      put "Format 6. result: " x = 6.;
14      put "Format Best4. result: " x = Best4.;
15   run;

NOTE: Non-portable document will be produced. The current settings of FORMCHAR use nonstandard
      line-drawing characters and the resulting output file will not render correctly unless all
      readers of the document have the SAS Monospace font installed. To make your document
      portable, issue the following command:
      OPTIONS FORMCHAR="|----|+|---+=|-/\&amp;lt;&amp;gt;*";

NOTE: 4 lines were written to file PRINT.
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be
      shifted by the "BEST" format.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;The non-portable document bit is about the File Print destination.&lt;/P&gt;
&lt;P&gt;The part that reflects your question is the second Note about the W.D format is too small. You cannot display a 6 digit integer with 2 positions. SAS shifted the 4. format to a BEST4 so it displays in scientific notation as best it can with 4 positions. SAS Log tells you this may be the result. Since a width of 2 does not have room for at least one digit of the number, the E, indicating exponent, and a power of 10 then all that can be displayed in two positions is **.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The exercise for the interested leader: What would actually display if a format of 3. was specified?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Character values just get cutoff at the character limit but since a display of possibly "12" instead of "123456" would be terribly misleading in terms of numeric values SAS doesn't do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 15:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-data-from-SAS7BDAT-FILE-and-converting-it-into-txt-file/m-p/950562#M371726</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-13T15:01:38Z</dc:date>
    </item>
  </channel>
</rss>

