BookmarkSubscribeRSS Feed
Niugg2010
Obsidian | Level 7

I want to transfer datasets into xpt file.

there are two datasets x and x2;

for dataset x  the code produces errors: The variable name aaaaaaaaa is illegal for the version 6 file XPTFILE.X.DATA. 

the reason is variable aaaaaaaaa length is over 8;

 

for dataset x2 the code has errors: The character variable b has too long a value for the XPTFILE library.

the reason is value of b length is over 200.

 

I do not want to change the variable name and value. How can I deal with these two issues?

Thanks

 

 

data x;
aaaaaaaaa="aaa";
b="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
run;

data x2;
aaaaaaa="aaa";
b="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
run;

libname xptfile XPORT "G:\XXXX\abc.xpt";
proc copy in=work out = xptfile memtype=data;
select x;
run;

libname xptfile XPORT "G:\XXXXX\abc2.xpt";
proc copy in=work out = xptfile memtype=data;
select x2;
run;

4 REPLIES 4
ballardw
Super User

About your only option is not to attempt to send them to a VERSION 6 file. The version 6 will not support either of those: longer variable name or character value.

 

Are you attempting to make set that can be imported by someone on a different operating system that actualy is NOT using Version 6?

Niugg2010
Obsidian | Level 7

We are required to export datasets into XPT file.  I am not sure who will use this file.  

 

ballardw
Super User

You may need to ask someone to describe the actual file format. It seems that there is another type of file with an XPT format that is not actually a SAS Version 6 Transport file.

 

If it is supposed to be a Version 6 transport then you may need guidance on what they want to do with incompatable variable names, labels or character variable lengths.

Niugg2010
Obsidian | Level 7

Thanks. 

"Another type of file with an XPT format that is not actually a SAS Version 6 Transport file"?  can you please give me more details? I googled and have not figure out a method.

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2594 views
  • 0 likes
  • 2 in conversation