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

Hi 

 

  PROC COPY IN=Data_old OUT=Data_new ;
    SELECT mh;
  RUN;

Can anyone please help me understand this error.

 

ERROR: The format length of the variable MHTERM is too long for the Version 6 file SASXPT.MH.DATA.
ERROR: File SASXPT.MH.DATA has not been saved because copy could not be completed.

 

I am trying to convert a sas7bdat file to XPT file, in the process I encountered this error. 

 

I tried cleaning the column MHTERM and reprocessed it just incase if there are any hidden characters or like that, but it still doesnt help. 

 

Please advise. 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

You will have less problems using PROC CPORT/ CIMPORT to port SAS V7 plus datasets and catalogs to other SAS platforms as SAS names are not limited to 8 characters. It would help if you explained your use case for XPT in more detail so we can give further guidance.

View solution in original post

5 REPLIES 5
bharath86
Obsidian | Level 7
length of the variable is 200 cahracters.
SASJedi
SAS Super FREQ

You haven't shared enough on your intent to determine if another approach is feasible, nor enough of your code to determine precisely what the problem is, but on the surface, it looks like you are trying to export a SAS7BDAT file to an older version transport file format (SAS 6 XPT file). The newer SAS file format SAS7BDAT supports attributes not available in SAS 6, and that may be causing the problem. 

1. It would help to know why you need the XPORT file. How will the resulting XPORT file be used (in SAS, some other software package, etc.)? Knowing this might allow us to recommend a different, better approach.

2. Have you tried using the macros provided by SAS to accomplish this task? If you are running SAS 9.4M2 or newer, check out Usage Note 46944: New SAS® transport format and tools available.

May the SAS be with you!
Mark

Check out my Jedi SAS Tricks for SAS Users
FreelanceReinh
Jade | Level 19

Hi @bharath86,

 


@bharath86 wrote:

ERROR: The format length of the variable MHTERM is too long for the Version 6 file SASXPT.MH.DATA.


The error message says that there is a format associated with variable MHTERM whose length exceeds the limit (of 200) for the XPT file. So, you should either remove the format or change it to a format of length <=200, which should be no problem, given the length 200 of the variable. Either create a copy of the dataset (if you want to keep the original) or modify the existing dataset in place, as shown below:

 

proc datasets lib=Data_old nolist;
modify mh;
format mhterm;
quit;

The above step removes the format, but you can also append a format specification to the FORMAT statement:

format mhterm $yourfmt200.;

 

 

SASKiwi
PROC Star

You will have less problems using PROC CPORT/ CIMPORT to port SAS V7 plus datasets and catalogs to other SAS platforms as SAS names are not limited to 8 characters. It would help if you explained your use case for XPT in more detail so we can give further guidance.

bharath86
Obsidian | Level 7

Actually proc cport works much better than copy. Thanks It worked. 

 

I needed XPORT file for FDA submission. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1688 views
  • 1 like
  • 4 in conversation