BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aminkarimid
Lapis Lazuli | Level 10

Hello everybody,

Is there any way to import a .bak file of SQL Server into SAS?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

IIRC it's usually a txt file that has the code to create the data set. 

Open it as a text file using your favorite text editor (NotePad++  etc). 

 

The code usually doesn't won't translate directly into SAS but the conversion to SAS SQL should be relatively straightforward. 

 

Python can read it directly without converting.


You can use Python within SAS Viya so that's another option.

 

 

View solution in original post

5 REPLIES 5
Kurt_Bremser
Super User

.bak files are often automatically created backups when a file is changed, so it is necessary to know how the orignal file is structured or what type it is. Then you'll know if you can use proc import or if you can write a data step according to the specifications.

 

See https://en.wikipedia.org/wiki/Bak_file

aminkarimid
Lapis Lazuli | Level 10
This is a data base which is backed up from SQL server. DBMS has some advantages than file system (like decreased size). Python can read it directly without converting.
Kurt_Bremser
Super User

If you don't want to use a direct connection with SAS/ACCESS (to RDBMS or via ODBC), then you are better off by exporting from SQL Server to a text-based format like csv, and reading with a data step.

Parsing a proprietary format will be very hard, if possible at all.

Reeza
Super User

IIRC it's usually a txt file that has the code to create the data set. 

Open it as a text file using your favorite text editor (NotePad++  etc). 

 

The code usually doesn't won't translate directly into SAS but the conversion to SAS SQL should be relatively straightforward. 

 

Python can read it directly without converting.


You can use Python within SAS Viya so that's another option.

 

 

DanLees
Fluorite | Level 6

I might be wrong, but I didn't know SAS created .bak files of any kind.

 

What is/was the file originally? Has someone changed the extension as part of a backup routine, or is this a file created by a SAS utility as part of an underlying backup routine?

sas-innovate-2024.png

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 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
  • 2871 views
  • 1 like
  • 4 in conversation