How to import a .sas7bdat into SAS 9.4

Reply
Contributor
Posts: 22

How to import a .sas7bdat into SAS 9.4

Hi all,

 

So I know there have been a lot of threads about this issue, but none of the solutions listed seem to be working for me. I have tried:

 

data new;

set '\\***.gov\project\***_***_Store1\**\***\Surveys for ********\**** **\2015-2016 *\Deliverables\2016 04 deliverables\Analytic files\hcp_analyt.sas7bdat';

run;

 

and

 

libname work '\\***.gov\project\***_***_Store1\**\***\Surveys for ********\**** **\2015-2016 *\Deliverables\2016 04 deliverables\Analytic files\hcp_analyt.sas7bdat';

proc print data=work.'\\***.gov\project\***_***_Store1\**\***\Surveys for ********\**** **\2015-2016 *\Deliverables\2016 04 deliverables\Analytic files\hcp_analyt.sas7bdat';

run;

 

Both to no avail. I'm clearly missing something, and knowing me it's pretty obvious, but could someone please clear things up? Is it the length of my file name perhaps? The asterisks are actually words in my actual file, I just can't post the actual file. The spaces are actual spaces in my file name. The first code starts to work, but generates these errors:

 

..........

ERROR: The format REGION_RAKE was not found or could not be loaded.

ERROR: The format GENDER_RAKE was not found or could not be loaded........

(an error for each)

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.NEW may be incomplete. When this step was stopped there were 0

observations and 432 variables.

 

Super User
Posts: 1,244

Re: How to import a .sas7bdat into SAS 9.4

[ Edited ]

Try next code:

 

LIBNAME mydata '\\***.gov\project\***_***_Store1\**\***\Surveys for ********\**** **\2015-2016 *\Deliverables\2016 04 deliverables\Analytic files';   /* NOTE - without the SAS dataset name */

 

data want;

  set mydata.hcp_analyt;  /* NOTE: without suffix sas7bdat */

run;

 

As about format error messages - you need to recreate them or to assign a libname where the format cataloge exists.

In case the catalog is under same directory as "mydata" then just add:

  options fmtsearh= (mydata); before above code. 

Grand Advisor
Posts: 17,428

Re: How to import a .sas7bdat into SAS 9.4

If you have custom formats applied to the dataset but don't have the formats any more you can use

 

options nofmterr; 

 

This will strip the format from the data.

 

Esteemed Advisor
Posts: 5,202

Re: How to import a .sas7bdat into SAS 9.4

The syntax you are trying to use is the core of the SAS Language.
I sugest that you take the (free!) online programming class.
Data never sleeps
Ask a Question
Discussion stats
  • 3 replies
  • 480 views
  • 0 likes
  • 4 in conversation