STAT-4640
A SAS date constant is a date written in the following form:
'01JAN2000'd '31Dec11'D '1jan04'd '06NOV2000'D
What does SAS enable you to do?
- access and manage data across multiple sources - perform analyses and deliver information across your organization
SAS variable names can be how long?
32 characters
Batch mode
A SAS program is submitted to the operating environment for background processing
Interactive mode
A SAS program is submitted within a SAS interface for foreground processing
What is Base SAS and what does it provide?
Base SAS is the foundation for all SAS software. Base SAS provides the following: - a highly flexible, highly entensible, fourth-generation programming language - a rich library of encapsulated programming procedures - a choice of programming interfaces
PROC CONTENTS
Displays the descriptor portion of a SAS data set
If ODS is set to its default settings, what types of output are created by the code below? ods html file='c:\myhtml.htm'; ods pdf file='c:\mypdf.pdf';
HTML and PDF
What mode do we use in this class?
Interactive mode
What are the two modes for submitting a SAS program?
Interactive mode and batch mode
What is the purpose of closing the HTML destination in the code shown below? ods listing close; ods html ... ;
It conserves system resources.
3 possible SAS interfaces for processing a SAS program in interactive mode.
SAS Windowing Environment, SAS Enterprise Guide, SAS Studio (these listed past to present)
BY statement
The BY statement in a PROC SORT step specifies the sort variables, and if you indicate it, the sort order
When the code shown below is run, what does the file D:\Output\body.html contain? ods html body='d:\output\body.html'; proc print data=work.alpha; run; proc print data=work.beta; run; ods html close;
The PROC PRINT output for both Work.Alpha and Work.Beta.
Which of the following is a true statement about SAS output? a.SAS Enterprise Guide displays text (LISTING) output by default. b.SAS Enterprise Guide displays HTML output by default. c.SAS Studio displays SASREPORT output by default. d.The SAS windowing environment displays HTML output by default
The SAS windowing environment displays HTML output by default
What is the function of noobs?
Use the NOOBS option in the PROC PRINT statement to suppress the Obs column.
Which of the following statements is true regarding direct access of data sets?
You cannot specify END= with POINT=.
SAS Enterprise Guide
a client application that is accessed from the Windows operating environment
SAS
a suite of business solutions and technologies to help organizations solve business problems
SAS Studio
a web client that is accessed through an HTML5-compliant web browser
If you submit a program containing unbalanced quotation marks in SAS Enterprise Guide or SAS Studio, you can simply correct the error and resubmit the program a. True b. False
a. True
Which WHERE statement (or statements) results in the most efficient processing? proc sort data=orion.salesout=work.sales; /* where Salary<25500; */ by Country descending Salary; run; proc print data=work.sales noobs; by Country;sum Salary; /* where Salary<25500; */ var First_Name Last_Name Gender Salary; run; a.The WHERE statement in the PROC SORT step. b.The WHERE statement in the PROC PRINT step. c.Both WHERE statements are needed. d.The WHERE statements are equally efficient.
a.The WHERE statement in the PROC SORT step. Subsetting in PROC SORT is more efficient. It selects and sorts only the required observations. Be sure to use the OUT= option when you subset in PROC SORT or you will overwrite your original data set with the subset.
n which portion of a SAS data set are the following found? the name of the data set the type of the variable Salary the creation date of the data set a.descriptor portion b.data portion
a.descriptor portion
SAS windowing environment
an application that is accessed from different operating environments
Using ODS statements, how many types of output can you generate at once?
as many as you want
Which of the following is a valid name for a character format?a.country b.$ctry c.$country. d._country
b. $ctry
Which of the following steps is typically used to generate reports and graphs? a.DATA b.PROC c.REPORT d.RUN
b. PROC
What happens if you submit the following program? porc print data=work.newsalesemps; run; a. SAS does not execute the step b. SAS assumes that the keyword PROC is mispelled and executes the PROC PRINT step
b. SAS assumes that the keyword PROC is mispelled and executes the PROC PRINT step
What result would you expect from submitting this step? proc print data=work.newsalesemps run; a.an HTML report of the work.newsalesemps data set b.an error message in the log c.a LISTING report of the work.newsalesempsdata set d.the creation of the temporary data set work.newsalesemps
b. because there is no semicolon after first line
Suppose you submit a short, simple DATA step. If the active window displays the message DATA step running for a long time, what probably happened? a.You misspelled a keyword. b.You forgot to end the DATA step with a RUN statement. c.You specified an invalid data set option. d.Some data values were not appropriate for the SAS statements that you specified
b.You forgot to end the DATA step with a RUN statement.
Which of the following correctly assigns the libref myfilesto a SAS library in the c:\mysasfiles folder? a.libname orion myfiles "c:\mysasfiles"; b.libname myfiles "c:\mysasfiles"; c.libref orion myfiles "c:\mysasfiles"; d.libref myfiles "c:\mysasfiles";
b.libname myfiles "c:\mysasfiles";
Suppose that this program contains no errors. What happens when you submit the program in the SAS windowing environment? proc print data=work.sales; run; a.Messages appear in the Log window, and the Explorer window moves to the front. b.Any HTML output appears in the Output window or a browser window, and any LISTING output appears in the Results Viewer window. c.Any HTML output appears in the Results Viewer window or a browser window, and any LISTING output appears in the Output window.
c.Any HTML output appears in the Results Viewer window or a browser window, and any LISTING output appears in the Output window.
SAS formats
can be used in a PROC step to change how values are displayed in a report.
DATA steps typically....
create SAS data sets
Which of the following is a SAS syntax requirement? a.Begin each statement in column one. b.Put only one statement on each line. c.Separate each step with a line space. d.End each statement with a semicolon. e.Put a RUN statement after every DATA or PROC step.
d. end each statement with a semicolon
general properties
data set name and number of observations
PROC PRINT
displays the data portion of a SAS data set Ex.) proc print data=work.newsalesemps; run;
the LOW keyword
includes missing values for character variables does not include missing values for numeric variables
Locating data files
let path=s:\workshop; infile "&path\sales.csv"; infile "&path\payroll.dat"
Are SAS variable names case sensitive?
no
PROC steps typically...
process SAS data sets to generate reports and graphs, and to manage data
The SORT procedure
replaces the original data set or creates a new one can sort on multiple variables sorts in ascending (default) or descending order does not generate printed output **The input data set is overwritten unless the OUT= option is used to specify an output data set.
The ID statement
specifies the variable or variables to print at the beginning of each row instead of an observation number.
To cancel a libref
submit a LIBNAME statement with the CLEAR option. libname orion clear;
To change a libref
submit a LIBNAME statement with the same libref but a different path. libname orion "c:\myfiles";
variable properties
such as name, type, length
The data portion of a SAS data set contains....
the data values, which are either character or numeric