BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8

Hi if I have lots of sas data file but have no sas license, is it possible to convert sas data file using any other softwares and have it saved as text file or excel file etc? or store it in another database like the Oracle?

56 REPLIES 56
japelin
Rhodochrosite | Level 12

You can use WPS or CDATA Drivers for SAS Datasets for access SAS datasets.

I don't know if you can access all data sets encrypted, compressed, passworded, etc.

 

HeatherNewton
Quartz | Level 8

are these free software?

japelin
Rhodochrosite | Level 12
Kurt_Bremser
Super User

@HeatherNewton wrote:

are these free software?


Both supplied links mention prices, so I would say no.

If it is not for commercial, but educational purposes, you can do the conversion on SAS On Demand for Academics.

andreas_lds
Jade | Level 19

I would not like to rely on third-party-tools that may or may not be able to read datasets. Before moving away from SAS - a strange idea - i would save all dataset to a database, if the required access module is licensed. If not, exporting to json is possible, if you have a recent release of sas. Or, as export to csv along with proc contents of the dataset.

ballardw
Super User

Upload the files to SAS On Demand, unless they are really big and do a conversion there to CSV or other file format, then download the converted files.

 

Some other programs can use/read SAS data sets. Tableau is one for example. SPSS might, been a long time since I used that program.

 

There used to be some utility programs that were not free that did such conversions but the ones I am familiar with died about the time of SAS 8 was released.

Ksharp
Super User
You can read SAS dataset and save it as text or excel by Python .

https://www.marsja.se/how-to-read-sas-files-in-python-with-pandas/
FreelanceReinh
Jade | Level 19

I've just verified that the SAS Universal Viewer (I'm using release 1.42) can save SAS datasets as CSV or XML files: There is a "Save as..." item in the "Table" menu. Of course, without third-party automation software this would be a tedious manual process if you have "lots of" SAS datasets. Also I would be skeptical about using this for really large datasets, but 100,000 observations with a few variables are no problem.

 

See partial example output from sashelp.class below. The use of a comma as the decimal separator (which is disastrous in the CSV file) is certainly due to my German Windows regional settings and could be changed there.

 

CSV:

"Name","Sex","Age","Height","Weight"
"Alfred","M",14,69,112,5
"Alice","F",13,56,5,84

XML:

<?xml version="1.0" encoding="utf-8"?>
<LIBRARY type="GENERIC" version="9.2">
   <CLASS>
      <Name>Alfred</Name>
      <Sex>M</Sex>
      <Age>14</Age>
      <Height>69</Height>
      <Weight>112,5</Weight>
   </CLASS>
   <CLASS>
      <Name>Alice</Name>
      <Sex>F</Sex>
      <Age>13</Age>
      <Height>56,5</Height>
      <Weight>84</Weight>
   </CLASS>
Sajid01
Meteorite | Level 14

Hello
Python and R can be used to convert SAS datasets into other formats.
I am giving a sample code as follows. This should work

import pandas as pd ;
df=pd.read_sas(r"C:\Users\yourname\actors.sas7bdat",encoding="utf-8");
# saving the excel
df.to_excel(r'C:\Users\yourname\actors.xlsx');
print('DataFrame is written to Excel File successfully.');
HeatherNewton
Quartz | Level 8

does anyone know how I can  read sas dataset in Oracle database?

I know I can use Python to read sas dataset into excel. 

is there a direct way to convert sas dataset to be stored directly in Oracle database?

andreas_lds
Jade | Level 19

If you have Access To Oracle licensed than you can use tables in oracle nearly the same way you use sas datasets.

As i already said earlier, exporting to csv is always possible, you should export the result of proc contents, too, so that all metadata of a dataset is available, so that using the csv files is easier.

HeatherNewton
Quartz | Level 8

if my sas file is really really large and excel has a limit of no of rows, what can i do?

would converting to text also possible with python? 

actually we would like to store in Oracle

Kurt_Bremser
Super User

Exporting to text is done in SAS with a DATA step, no other tools needed. Have your Oracle people give you the preferred file format. If you need assistance with writing the step, post the format requirements (in a new question), and we can give you a "blueprint" DATA step.

HeatherNewton
Quartz | Level 8

thanks all,

 

the problem is we dont have SAS license, we have  7G of SAS datasets that need to be converted to save in Oracle.

how to convert sas dataset without SAS, I have Oracle license. I can use Python. any other means?

if it is really large, can excel takes it or have to convert to text?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 56 replies
  • 5420 views
  • 6 likes
  • 12 in conversation