BookmarkSubscribeRSS Feed
Calcite | Level 5

I have a very large sd2 dataset file which is about 42GB. I can only load it into SAS by a script which qualifies certain variables. I cannot read the dataset structure nor open it in SAS universal viewer. I have tried all the methods I can find on the Internet and forums, including but not limited to using old v6. For example, all of the following scripts don't work:

libname in v6 'path';
libname out v9 'path';
proc copy inlib=in outlib=out;
libname new 'path';
libname old v6 'path';
data new.test;
set old.test; 
libname out v9 'path';                                                                                                        
libname in v6 'path';                                                                                                               
data in.test;                                                                                                                       
  infile 'path';                                                                                                       

I think the main error is that: Write access to member 'IN.TEST.DATA' is denied. I don't know why. How can i convert the sd2 file to sas7bdat?

Super User Tom
Super User

SAS does not have any trouble with a directory having mixed version 6 and version 7/8/9 format files in the same directory.


But you do need to tell it which engine to use for which libref.  Otherwise it will pick one for you (and I am not sure what logic it uses to pick).

libname in v6 'path';
libname out v8 'path';

@Kurt_Bremser wrote:

Avoid having two LIBNAMEs pointing to the same path. You can't have test.sd2 and test.sas7bdat in the same directory, SAS does not allow this.


Super User Tom
Super User

Your first step looks right.  You are copying the V6 dataset to a V9 dataset.

Your second step also looks right, but the libref NEW is WRONG (or at least potentially wrong or confusing).   If you don't tell SAS what engine to use it will pick one based on the files in the directory.  If the only SAS datasets that are there are V6 then it will pick V6.


Use BASE as the engine and SAS will use the default engine for whatever version of SAS you are running.

libname new base 'path';


The last one is flat out wrong.  You cannot write a V6 dataset unless you are running SAS 8 or earlier.  INFILE is for reading TEXT files (or reading binary files as text).  You cannot use it to read a SAS dataset or a directory.

Onyx | Level 15

Hi @williamty 

1) can you share log from the 1st and 2nd steps.

2) and you are working on Windows, right? (e.g. Linux does not have v6 engine)



Polish SAS Users Group: and

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation


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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 5 in conversation