You can define two macro variables to use as server names in the SIGNON Statement. Have both of them point to the WRDS server.
Issue SIGNON statements for both, using the different credentials, then issue RLS LIBNAMEs as needed.
Can you run 2 libname statements?
I think the hard part is that in sas code, I can't make 2 connections simultaneously (with different account) to WRDS. At any time I can only access one database, and have no rights to access another. I think when I submit my SQL statements to WRDS sever, I will only execute it within one account's workspace.
How do you connect to WRDS now? We can't really help unless you provide these details.
I attach the sas file. It merge 3 different database compustat, crsp and IBES to calculate what I need.
One of my account have compustat and crsp rights, another account have IBES rights.
I use signon to connect WRDS, but any accout can't acess all 3 databases simultaneously.
So what's the problem then? You can easily SIGNON to each of the three databases, download what you need, then combine results on local SAS if required.
Thank you for your answer! It's what I'm trying, while I need to download a bit more data to local. For this question, I also try to find a way to do joint conditional selection from different database, and then only download the final results to local.
> only download the final results to local.
If you want to subset data A using data B, and data B is not accessible to data A, and you can't upload data B to location A, then you can't do that.
How could you?
So either you find a way to get data B where data A is (or at least the download criteria), or you must do the join and selection after downloading the full sets.
Typically, the way to download a subset is to put the selection criteria in a WHERE clause.
In other words: You don't bring data B to location A as data, you bring data B to location A as code.
The downside of course is that if you have a million values that you want to select, that's rather long piece of code.
You can define two macro variables to use as server names in the SIGNON Statement. Have both of them point to the WRDS server.
Issue SIGNON statements for both, using the different credentials, then issue RLS LIBNAMEs as needed.
I tried 2 ways as following but both failed:
%let wrds=wrds.wharton.upenn.edu 4016;options comamid=TCP remote=WRDS;
signon wrds macvar=rhost1;username=aaa password=xxx;
signon wrds macvar=rhost2;username=bbb password=xxx;
NOTE: A link to WRDS has been previously established. SIGNON is not necessary.
%let wrds1=wrds.wharton.upenn.edu 4016;options comamid=TCP remote=WRDS;
signon username=aaa password=xxx;
%let wrds2=wrds.wharton.upenn.edu 4016;options comamid=TCP remote=WRDS;
signon username=bbb password=xxx;
ERROR: A communication subsystem partner link setup request failure has occurred.
ERROR: Cannot locate TCP host 'WRDS'.
You need to use the separate definitions in the SIGNON.
signon wrds1 user=user1 password=pw1;
signon wrds2 user=user2 password=pw2;
If you still have problems, post your complete log by copy/pasting into a window opened with this button:
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.