<?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: Error Reading in V8 Transport Using %XPT2LOC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953702#M372556</link>
    <description>&lt;P&gt;You should probably ask them to remake the file.&amp;nbsp; &amp;nbsp;It was probably a user error that attached an invalid format specification to the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is really no need to attach any INFORMAT to variables that are already in a dataset.&amp;nbsp; The INFORMAT is used when converting values from text, like when reading in data from a text file.&amp;nbsp; So it will not be used at all when reading in data from an existing dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And there is usually never any need to use an INFORMAT that has decimal places specified.&amp;nbsp; That is only used when you want SAS to imply a decimal point for characters strings that do not have one.&amp;nbsp; It was common in the old days to save one character when punching your data onto 80 column cards.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2024 17:55:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-12-16T17:55:39Z</dc:date>
    <item>
      <title>Error Reading in V8 Transport Using %XPT2LOC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953677#M372552</link>
      <description>&lt;P&gt;I am trying to read a V8 transport file into my work library using %XPT2LOC, but receive an error in the log. R does not have any issue reading the file using haven::read_xpt().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SETINIT and PRODUCT_STATUS Information:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Operating System:   SUN 64  .
For Base SAS Software ...
   Custom version information: 9.4_M3
   Image version information: 9.04.01M3P060315
For SAS/STAT ...
   Custom version information: 14.1
For SAS/GRAPH ...
   Custom version information: 9.4_M3
For SAS/Secure 168-bit ...
   Custom version information: 9.4_M2
For High Performance Suite ...
   Custom version information: 2.2_M4&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;SAS Code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options nocenter ps=max validvarname=any ls=170;

%xpt2loc(filespec='FULL_PATH/name.xpt',
         memlist=pp);

proc contents data=pp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;25         options nocenter ps=max validvarname=any ls=170;
26         
27         %xpt2loc(filespec='FULL_PATH/name.xpt',
28                  memlist=pp);
NOTE: Format XPRTFLT has been output.
NOTE: Informat XPRTFLT has been output.
NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
NOTE: The data set WORK.CNTLIN has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.07 seconds
NOTE: There were 1 observations read from the data set WORK.CNTLIN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CNTLIN has 1 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.02 seconds
NOTE: Format $MEMWANT has been output.
NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
NOTE: There were 1 observations read from the data set WORK.CNTLIN.
NOTE: Deleting WORK.CNTLIN (memtype=DATA).
NOTE: PROCEDURE DELETE used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The infile 'FULL_PATH/name.xpt' is:
      Filename=FULL_PATH/name.xpt,
      Owner Name=root,Group Name=datalib,
      Access Permission=-rw-r--r--,
      Last Modified=11Dec2024:09:57:58,
      File Size (bytes)=683200
NOTE: The file METADATA is:
      Filename=/opt/tmp2/SAS_workAC2B00001EE5_stats1/#LN00014,
      Owner Name=jnichols,Group Name=users,
      Access Permission=-rw-rw----,
      Last Modified=16Dec2024:10:17:28

NOTE: The file INPTSTMT is:
      Filename=/opt/tmp2/SAS_workAC2B00001EE5_stats1/#LN00013,
      Owner Name=jnichols,Group Name=users,
      Access Permission=-rw-rw----,
      Last Modified=16Dec2024:10:17:28
NOTE: 32 records were written to the file METADATA.
      The minimum record length was 1.
      The maximum record length was 105.
NOTE: 25 records were written to the file INPTSTMT.
      The minimum record length was 3.
      The maximum record length was 43.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.20 seconds
NOTE: The file SASCODE is:
      Filename=/opt/tmp2/SAS_workAC2B00001EE5_stats1/#LN00016,
      Owner Name=jnichols,Group Name=users,
      Access Permission=-rw-rw----,
      Last Modified=16Dec2024:10:17:28
NOTE: The infile INPTSTMT is:
      Filename=/opt/tmp2/SAS_workAC2B00001EE5_stats1/#LN00013,
      Owner Name=jnichols,Group Name=users,
      Access Permission=-rw-rw----,
      Last Modified=16Dec2024:10:17:28,
      File Size (bytes)=485
NOTE: The infile METADATA is:
      Filename=/opt/tmp2/SAS_workAC2B00001EE5_stats1/#LN00014,
      Owner Name=jnichols,Group Name=users,
      Access Permission=-rw-rw----,
      Last Modified=16Dec2024:10:17:28,
      File Size (bytes)=807
NOTE: 56 records were written to the file SASCODE.
      The minimum record length was 1.
      The maximum record length was 105.
NOTE: 25 records were read from the infile INPTSTMT.
      The minimum record length was 3.
      The maximum record length was 43.
NOTE: 32 records were read from the infile METADATA.
      The minimum record length was 1.
      The maximum record length was 105.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
NOTE: Fileref METADATA has been deassigned.
NOTE: Fileref INPTSTMT has been deassigned.
38        +informat PPSEQ  .12 ;
                           ___
                           265
48        +informat PPSTRESN  .12 ;
                              ___
                              265
55        +informat VISITNUM  .12 ;
                              ___
                              265
ERROR 265-185: The decimal specification of 12 must be less than the width specification.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements. This might cause NOTE: No observations in data set.
WARNING: The data set WORK.PP may be incomplete.  When this step was stopped there were 0 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
NOTE: Fileref SASCODE has been deassigned.
85         
86         proc contents data=pp;
87         run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;SAS Universal Viewer&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="J3ff_0-1734362438150.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103032i38C4C5240B6A0943/image-size/medium?v=v2&amp;amp;px=400" role="button" title="J3ff_0-1734362438150.png" alt="J3ff_0-1734362438150.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Header Information as viewed in Notepad++&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="J3ff_1-1734362549877.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103033i53F0FC2CA56D281D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="J3ff_1-1734362549877.png" alt="J3ff_1-1734362549877.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953677#M372552</guid>
      <dc:creator>J3ff</dc:creator>
      <dc:date>2024-12-16T15:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Error Reading in V8 Transport Using %XPT2LOC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953678#M372553</link>
      <description>&lt;P&gt;How was the file created? Was it created by SAS or some other software? What other software?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you move the file from one machine to another? Are you sure the move treated the file as BINARY file?&amp;nbsp; If you used FTP or other file transfer and it decided to insert or remove CR characters from the file that would corrupt it.&amp;nbsp; It it tried to transcode the file from one encoding to another that would corrupt the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When XPT2LOC reads the variable descriptions from that file the INFORMAT associated with the variable is invalid.&amp;nbsp; It appears to have decimal places set to 12 and width set to zero.&amp;nbsp; So the SAS code that the macro generates to read the data is invalid, hence the error you see in the LOG. Since R doesn't use SAS informats that is probably why R does not mind that the file has gibberish for the INFORMAT setting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try seeing if this macro can read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/xport2sas.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/xport2sas.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if it gets a similar error perhaps you could use the SASCODE= optional parameter to the macro to tell it where to save the SAS code it generated to read the file.&amp;nbsp; Then you could try copying that code and tweaking the formats/informats and see if you can get it to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the data is not sensitive you could share a copy of the file and others can try examining it.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953678#M372553</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-16T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error Reading in V8 Transport Using %XPT2LOC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953696#M372554</link>
      <description>&lt;P&gt;Thank you Tom for you quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset was provided by our client and I am not sure how the file was created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the XPT2SAS macro did produce similar errors to the XPT2LOC macro, I was able to use the code written with the SASCODE option with the informat lines removed to successfully read the V8 xpt.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953696#M372554</guid>
      <dc:creator>J3ff</dc:creator>
      <dc:date>2024-12-16T17:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error Reading in V8 Transport Using %XPT2LOC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953702#M372556</link>
      <description>&lt;P&gt;You should probably ask them to remake the file.&amp;nbsp; &amp;nbsp;It was probably a user error that attached an invalid format specification to the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is really no need to attach any INFORMAT to variables that are already in a dataset.&amp;nbsp; The INFORMAT is used when converting values from text, like when reading in data from a text file.&amp;nbsp; So it will not be used at all when reading in data from an existing dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And there is usually never any need to use an INFORMAT that has decimal places specified.&amp;nbsp; That is only used when you want SAS to imply a decimal point for characters strings that do not have one.&amp;nbsp; It was common in the old days to save one character when punching your data onto 80 column cards.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Reading-in-V8-Transport-Using-XPT2LOC/m-p/953702#M372556</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-16T17:55:39Z</dc:date>
    </item>
  </channel>
</rss>

