BookmarkSubscribeRSS Feed
fafrin420
Fluorite | Level 6

Hi all,

I want to download data file from wrds server (https://wrds-web.wharton.upenn.edu/wrds/) using SAS studio and then run my desired code on that data using PC SAS. I could download data using SAS studio but can only save the data to my PC in csv format. I want to save the file in sas7bdat format. Please help me 😄

3 REPLIES 3
Reeza
Super User

@fafrin420 wrote:

Hi all,

I want to download data file from wrds server (https://wrds-web.wharton.upenn.edu/wrds/) using SAS studio and then run my desired code on that data using PC SAS. I could download data using SAS studio but can only save the data to my PC in csv format. I want to save the file in sas7bdat format. Please help me 😄


To 'save' it in SAS7BDAT form, map a directory to your local drive and then copy/move the file there. 

 

However, if you're using Wharton's SAS Studio implementation, you're likely stuck with CSV. That's not a bad decision because CSV files are much smaller than SAS7BDAT. You can usually right click a file in SAS Studio and download it that way as well, or navigate to the storage location in the Servers Files Folder Pane, select the item and click the down arrow. 

 

Cynthia_sas
SAS Super FREQ

Hi:
There have been several previous postings about using WRDS with SAS Studio but I am not sure what issue you're running into if you have been able to read the WRDS data.

If SAS Studio is running in SAS University Edition, you should be able to write a SAS data set to your shared folder location. If SAS Studio is running in a local install of SAS, you should be able to write a SAS data set to your C: drive.

Assuming you are using SAS on Windows, with a local installation of SAS and you have a folder called C:\temp installed on your personal machine, then this should work for you:

libname perm 'c:\temp';

data perm.newdata;
set sashelp.class;
run;

proc contents data=perm.newdata;
run;

If that works using SASHELP.CLASS and you can go to your C: drive and see the newdata.sas7bdat file, then all you have to do is put your code to make your data set where I have created PERM.NEWDATA.

If you are using SAS University Edition with SAS Studio, then the only thing you have to change in the above program is the LIBNAME statement:
libname perm '/folders/myfolders';

If your issue is with WRDS, then I believe they have a help desk too.

cynthia

Yegen
Pyrite | Level 9

Similar to the suggestion by @Cynthia_sas (as far as I know, in SAS Studio WRDS one cannot directly export to the local machine, unless one is connected to the WRDS server with his or her local machine using SAS rather than SAS Studio and uses a program like WinSCP), you can do the following trick:

 libname out "/home/.../";
 data out.filename; 
   set filename;
 run;

Or you can do the following:

data '/home/.../filename.sas7bdat';
	set filename;
run;

Both should work. This exporting keeps your data in the .sas7dbat format. However, you can also use the following command if you want to export your data in .csv format:


proc export data=work.filename DBMS=csv
   outfile="/home/.../filename.csv" replace;
run;


I hope this helps @fafrin420.

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 3629 views
  • 0 likes
  • 4 in conversation