is alphabetical by variable name. The keyword _ALL_ can be used in place of the data set name, in this instance, the output contains a full list of all library members followed by metadata for each data set in the library.
The PRINT procedure directs the data portion of the selected data set to all active output destinations. By default, PROC PRINT displays variable names as column headers, the LABEL option changes these to the variable labels (when present). Display of labels is also controlled by the LABEL/NOLABEL system options, see Chapter Note 5 in Section 1.7 for additional details.
Default behavior of the PRINT procedure is to output all rows and columns in the current data order. The VAR statement selects the set of columns and their order for display.
Output 1.4.4A: Output from PROC CONTENTS for Sashelp.Cars
Data Set Name | SASHELP.CARS | Observations | 428 |
Member Type | DATA | Variables | 15 |
Engine | V9 | Indexes | 0 |
Created | Local Information Differs | Observation Length | 152 |
Last Modified | Local Information Differs | Deleted Observations | 0 |
Protection | Compressed | NO | |
Data Set Type | Sorted | YES | |
Label | 2004 Car Data | ||
Data Representation | WINDOWS_64 | ||
Encoding | us-ascii ASCII (ANSI) |
Engine/Host Dependent Information | |
Data Set Page Size | 65536 |
Number of Data Set Pages | 2 |
First Data Page | 1 |
Max Obs per Page | 430 |
Obs in First Data Page | 413 |
Number of Data Set Repairs | 0 |
ExtendObsCounter | YES |
Filename | Local Information Differs |
Release Created | 9.0401M4 |
Host Created | X64_SR12R2 |
Owner Name | BUILTIN\Administrators |
File Size | 192KB |
File Size (bytes) | 196608 |
Alphabetic List of Variables and Attributes | |||||
# | Variable | Type | Len | Format | Label |
9 | Cylinders | Num | 8 | ||
5 | DriveTrain | Char | 5 | ||
8 | EngineSize | Num | 8 | Engine Size (L) | |
10 | Horsepower | Num | 8 | ||
7 | Invoice | Num | 8 | DOLLAR8. | |
15 | Length | Num | 8 | Length (IN) | |
11 | MPG_City | Num | 8 | MPG (City) | |
12 | MPG_Highway | Num | 8 | MPG (Highway) | |
6 | MSRP | Num | 8 | DOLLAR8. | |
1 | Make | Char | 13 | ||
2 | Model | Char | 40 | ||
4 | Origin | Char | 6 | ||
3 | Type | Char | 8 | ||
13 | Weight | Num | 8 | Weight (LBS) | |
14 | Wheelbase | Num | 8 | Wheelbase (IN) |
Sort Information | |
Sortedby | Make Type |
Validated | YES |
Character Set | ANSI |
Output 1.4.4B: Output from PROC PRINT (First 10 Rows) for Sashelp.Cars
Obs | Make | Model | MSRP | MPG (City) | MPG (Highway) |
1 | Acura | MDX | $36,945 | 17 | 23 |
2 | Acura | RSX Type S 2dr | $23,820 | 24 | 31 |
3 | Acura | TSX 4dr | $26,990 | 22 | 29 |
4 | Acura | TL 4dr | $33,195 | 20 | 28 |
5 | Acura | 3.5 RL 4dr | $43,755 | 18 | 24 |
6 | Acura | 3.5 RL w/Navigation 4dr | $46,100 | 18 | 24 |
7 | Acura | NSX coupe 2dr manual S | $89,765 | 17 | 24 |
8 | Audi | A4 1.8T 4dr | $25,940 | 22 | 31 |
9 | Audi | A41.8T convertible 2dr | $35,940 | 23 | 30 |
10 | Audi | A4 3.0 4dr | $31,840 | 20 | 28 |
1.4.4 The SAS Log
The SAS log tracks program submissions and generates information during compilation and execution to aid in the debugging process. Most of the information SAS displays in the log (besides repeating the code submission) falls into one of five categories:
Errors: An error in the SAS log is an indication of a problem that has stopped the compilation or execution process. These may be generated by either syntax or logic errors, see the example in this section for a discussion of the differences in these two error types.
Warnings: A warning in the SAS log is an indication of something unexpected during compilation or execution that was not sufficient to stop either from occurring. Most warnings are an indication of a logic error, but they can also reflect other events, such as an attempt by the compiler to correct a syntax error.
Notes: Notes give various information about the submission process, including: process time, records and data set used, locations for file delivery, and other status information. However, some notes actually indicate potential problems during execution. Therefore, reviewing notes is important, and they should not be presumed to be benign. Program 1.4.5, along with others in later chapters, illustrates such an instance.
Additional Diagnostic Information: Depending on the nature of the note, error, or warning, SAS may transmit additional information to the log to aid in diagnosing the problem.
Requested Information: Based on various system options and other statements, a SAS program can request additional information be transmitted to the SAS log. The ODS TRACE statement is one such statement covered in Section 1.5. Other statements and options are included in later chapters.
Program 1.4.5 introduces errors into the code given in Program 1.4.1, with a review of the nature of the mistakes and the log entries corresponding to them shown in Figure 1.4.8. Errors can generally be split into two types: syntax and non-syntax errors. A syntax error occurs when the compiler is unable to recognize a portion of the code as a legal statement, option, or other language element; thus, it is a situation where programming statements do not conform to the rules of the SAS language. A non-syntax error occurs when correct syntax rules are used, but in a manner that leads to an incorrect result (including no result at all). In this book, non-syntax errors are also referred to as logic errors (an abbreviated phrase referring to errors in programming logic). Chapter Note 6 in Section 1.7 provides a further refinement of such error types.
Program 1.4.5: Program 1.4.1 Revised to Include Errors
options pagesize=100 linesize=90 number pageno=1 nodate;
data work.cars;
set sashelp.cars;
mpg_combo=0.6*mpg_city+0.4*mpg_highway;
select(type);
when(‘Sedan’,’Wagon’) typeB=’Sedan/Wagon’;
when(‘SUV’,’Truck’) typeB=’SUV/Truck’;
otherwise typeB=type;
end;
label mpg_combo=’Combined MPG’ type2=’Simplified Type’;
run;
Title ‘Combined MPG Means’;
proc sgplot daat=work.cars;
hbar typeB / response=mpg_combo stat=mean limits=upper;
where typeB ne ‘Hybrid’;
run;
Title ‘MPG Five-Number Summary’;
Titletwo ‘Across Types’;
proc means data=car min q1 median q3 max maxdec=1;
class