BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yayoi_Kurikyu
Fluorite | Level 6

Hello,

 

I am a beginner of SAS studio and I tried to get access to CRSP database which is supposed to be in 'Libraries'. 

 

https://wrds-www.wharton.upenn.edu/pages/support/programming-wrds/programming-sas/querying-wrds-data...

 

According to this page, these datasets should take place automatically. However, I think because I wrongly reset SAS session, I cannot find any WRDS datasets now and have no idea how to make it back.

 

Now my local library looks like this.

 

捕获.PNG

 

 

 

 

And when I try to import data from dataset such as compustat, it shows: 

 
data compustat;
set comp.funda;
ERROR: Libref COMP is not assigned.
if indfmt='INDL' and datafmt='STD' and popsrc='D' and consol='C';
keep gvkeyn fyear fyr datadate act lt pstkc conm sich;
run;
 

I am sorry to bother you with this basic question. And I am really thankful for all your help.

 

Best,

Yayoi

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Yayoi_Kurikyu
Fluorite | Level 6

I have found the missing code for autoexec:

 

* The library name definitions below are used by SAS;
* Assign default libref for WRDS (Wharton Research Data Services);

%include '/wrds/lib/utility/wrdslib.sas' ;
options sasautos=('/wrds/wrdsmacros/', SASAUTOS) MAUTOSOURCE;

 

Thank you for help.

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

Just re-run the LIBNAME statement you used before to create the libref COMP.

It should probably look something like:

libname comp 'some path on your SAS server';

Just figure out where you pointed the libref before and recreate it.

If you really created a dataset named FUNDA then there should be a file named 'funda.sas7bdat' in the directory.

Yayoi_Kurikyu
Fluorite | Level 6

Hello Tom.

 

Thank you for replying. However, the problem is that when I first time get access to SAS Studio, it has all access to the libraries on the WRDS and I do not have to type into the command such as libname crsp ''/wrds/crsp/sasdata/m_ccm'';

 

And I have another problem when I tried to create the CRSP library. When I try to run 

 

libname crsp '/wrds/crsp/sasdata/m_ccm';

data permnolist;
set crsp.msf;
keep permno;
if year(date)>1969;
run;

 

it says ERROR: User does not have appropriate authorization level for file CRSP.MSF.DATA.

 

But I am pretty sure my university has subscribed the CRSP and I just used it a few days ago before I restore my libraries.

 

Thank you very much.

 

Yayoi

Yayoi_Kurikyu
Fluorite | Level 6

I have found the missing code for autoexec:

 

* The library name definitions below are used by SAS;
* Assign default libref for WRDS (Wharton Research Data Services);

%include '/wrds/lib/utility/wrdslib.sas' ;
options sasautos=('/wrds/wrdsmacros/', SASAUTOS) MAUTOSOURCE;

 

Thank you for help.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 5618 views
  • 0 likes
  • 2 in conversation