Skip to Main Content

Knowledge Base

WRDS Web Query Form Conditional Statement Builder

Many of the datasets in WRDS include a Conditional Statement Builder in the Web Query Form to make it easier to download the data you need.

Use the Conditional Statement Builder to do things like get data for just:

  • equities traded on a specific exchange
  • companies headquartered in a specific country
  • specific class shares (like A-shares or REITs)

Example

Use the Conditional Statement Builder to get daily price data for securities traded on the NYSE for December 2019.

Step 1: Navigate to the CRSP Daily Stock File

  1. Connect to CRSP – see WRDS access help.
  2. Under Subscriptions go to CRSP > Stock/Security Files > Daily Stock File.

Step 2: Fill out the Web Query Form

  1. Step 1: Enter the date range (December 1, 2019 to December 31, 2019).
  2. Step 2: Select Search the Entire Database.
  3. Step 3: Select the desired variables. In this example select: Company Name, Ticker, CUSIP, NCUSIP, CRSP Permanent Company Number (as it is always good to have all the identifiers) and Price.
    1. In order to use a variable in the Conditional Statement Builder (such as the exchange), you must select it as a query variable. Before adding it to your selected variables, use the (?) icon to note the code you will need in the Conditional Statement Builder. In this example, you need to know that 1 is the Exchange Code for the NYSE.
    2. In the Conditional Statements drop-down menu select the variable you want to use (in this case, Exchange Code). Change the second drop-down if needed (such as to exclude a share code) and in the third field enter the exchange code for the NYSE, which is 1.
  4. Step 4: Select the output (e.g. csv).
  5. Press Submit Query. When the download is complete, click the link to view.




Answered By: Alice Kalinowski
Dec 02, 2021

Related Library Tips

    Resource Use

    Most resources are only available to current Stanford students, faculty, and staff.

    Researchers are responsible for using these resources appropriately. See the eResources Usage policy.

    Accessibility Support

    Ask Us for accessibility support with library resources.