WRDS Web Query Form Conditional Statement Builder

The WRDS Web Query Form makes it easy to download data from a large range of datasets in a standardized manner. Many of the databases in WRDS include a Conditional Statement Builder as part of the Web Query Form.

Common ways to use the Conditional Statement Builder are to only download data for:

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


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. Use the CRSP (in WRDS) link on the library's website and log in to WRDS (see WRDS Access).
  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
Last Updated: Jun 03, 2020

Related Library Tips

    Resource Use

    Most resources listed are only available to current Stanford students, faculty, and staff with an active SUNet ID