Invoking the SQL Query Window

You can invoke the SQL Query Window in one of the following ways:
  • In the SAS command window or at the Command ===> prompt, issue the QUERY command.
    You can also specify these optional arguments:
    profile=
    the name of a user-defined profile that you want to use for your SQL Query Window session. You can specify a profile by using the following syntax: profile=libref.catalog.profile
    access=
    the access mode (source of the data that you are going to use) for the SQL Query Window session.
    active=
    data=
    the name of the table (active SAS data set) that you want to use in your initial query.
    You can select more than one table by using the following syntax: data='table1, table2'
    where table1 and table2 are the names of the tables that you want to use in your initial query.
    If you use this argument, then the SQL Query Window is invoked with the table or tables already selected, and you go directly to the SQL QUERY COLUMNS window.
    include=
    the name of a stored query that you want to include in your SQL Query Window session. You can include a stored query by using the following syntax: include=libref.catalog.query
    where libref is the library reference, catalog is the catalog in which the query is stored, and query is the query name.
    If you use this argument, then the SQL Query Window is invoked with the query components already selected, and you go directly to the SQL QUERY COLUMNS window.
  • From any SAS window, select Toolsthen selectQuery.
  • If SAS/ASSIST software is installed at your site, then you can follow this selection path: Tasks then selectData Managementthen selectQuerythen selectSQL Query.
  • From a SAS/AF application, the method that you use depends on whether the application has a frame or program screen.
    • If the application has a frame or program screen, then you can invoke it with this command:
      SUBMIT COMMAND CONTINUE;
         QUERY
      ENDF SUBMIT;
      Following the QUERY statement, you can specify any of the optional arguments that were described earlier for the command window or Command ===> prompt.
    • If the application has no frame or program screen, then you can invoke it with a CALL EXECCMD statement:
      CALL EXECCMD ('QUERY');
      Optional arguments can follow the word QUERY and must precede the closing quotation mark.