The data used to create the 'prob12_18' dataset is directly included in the SAS script via the DATALINES statement, making it an internal and integrated data source within the code.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block is responsible for creating the 'prob12_18' dataset. The `input` statement reads the raw data provided in the `datalines` section, specifying informats for each variable (e.g., `mmddyy10.` for DATE, `$11` for GENDER, numeric positions for AGE and SCORE). The `format` statement applies a display format to the DATE variable. The `if GENDER = 'F';` statement acts as an implicit filter, retaining in the final dataset only observations where the GENDER variable is equal to 'F'.
Copied!
data prob12_18;
input DATE mmddyy10. GENDER $11 AGE 12-13 SCORE 14-16;
format DATE mmddyy10.;
if GENDER = 'F';
datalines;
04/04/2004M15 90
05/12/2004F16 95
07/23/2004M18 88
01/20/2004F17100
;
1
DATA prob12_18;
2
INPUT DATE mmddyy10. GENDER $11 AGE 12-13 SCORE 14-16;
3
FORMAT DATE mmddyy10.;
4
IF GENDER = 'F';
5
6
DATALINES;
7
04/04/2004M15 90
8
05/12/2004F16 95
9
07/23/2004M18 88
10
01/20/2004F17100
11
;
2 Code Block
PROC PRINT
Explanation : This block uses the PROC PRINT procedure to generate a tabular report displaying the content of the previously created 'prob12_18' dataset. The `title` statement sets the title 'Problem 12.18' which will appear above the report.
Copied!
proc print;
title 'Problem 12.18';
run;
1
PROC PRINT;
2
title 'Problem 12.18';
3
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.