STA 4102 FINAL EXAM WITH ALL CORRECT & 100%
VERIFIED ANSWERS (UPDATED TO PASS)
Data Step Correct answer-Data step: the data will be read by the SAS software
PROC Step Correct answer-in this step one or more SAS inbuilt functions will be called to run on
the data set earlier read by SAS
input statement Correct answer-here you declare/assign the name of the variables in the data set
non-numerical variable Correct answer-- has to have a $ after it
- by default only first 8 characters are read
- need to give $9. to read the full length
missing variable for character variables Correct answer-represented by "" empty input
missing variable for numeric variables Correct answer-represented by "." a dot
column style input Correct answer-specify the column position of each variable explicitly
- ex: INPUT alpha $1-5 beta 6-10
reading data from local file Correct answer-INFILE "file location\file/txt";
FILENAME creates string variables that points to data file location;
INFILE Statement Options Correct answer-- MISSOVER: do not go to next line if data value is
missing
- FIRSTOBS = m (start at line m)
- OBS = specifies the record number of the last record to read from input file
-DELIMITER = 'some character' (or dlm = 'some character'): specifies delimiter other than space, ex:
' , ' comma delimited text
- DSD: treats 2 consecutive delimiters as missing values
INFILE statement example Correct answer-infile "\\net.ucf.edu\Desktop\file.txt" dlm = "," firstobs =
2 missover dsd;
PROC UNIVARIATE Correct answer-used to request a variety of statistics for summarizing the data
distribution of each analysis variable (sample moments, CI, mean, std dev, test for normality,
frequeny counts, etc)
condition in which Shapiro-Wilks test is better Correct answer-when sample size is <=2000 & >6
if-then statement Correct answer-if gender = 'f' then sex = 'female'
else sex = 'male'
DO loops Correct answer-IF expression THEN DO;
1) DO var = start to stop
ex: DO i = 1 to 5; statements; OUTPUT; END;
2) DO var = start to stop by increment
ex: DO i = 1 to 100 by 10; OUTPUT; END;
3) DO var = list;
ex: DO i = 1,2,3,4,5....,6,7; OUTPUT; END;
VERIFIED ANSWERS (UPDATED TO PASS)
Data Step Correct answer-Data step: the data will be read by the SAS software
PROC Step Correct answer-in this step one or more SAS inbuilt functions will be called to run on
the data set earlier read by SAS
input statement Correct answer-here you declare/assign the name of the variables in the data set
non-numerical variable Correct answer-- has to have a $ after it
- by default only first 8 characters are read
- need to give $9. to read the full length
missing variable for character variables Correct answer-represented by "" empty input
missing variable for numeric variables Correct answer-represented by "." a dot
column style input Correct answer-specify the column position of each variable explicitly
- ex: INPUT alpha $1-5 beta 6-10
reading data from local file Correct answer-INFILE "file location\file/txt";
FILENAME creates string variables that points to data file location;
INFILE Statement Options Correct answer-- MISSOVER: do not go to next line if data value is
missing
- FIRSTOBS = m (start at line m)
- OBS = specifies the record number of the last record to read from input file
-DELIMITER = 'some character' (or dlm = 'some character'): specifies delimiter other than space, ex:
' , ' comma delimited text
- DSD: treats 2 consecutive delimiters as missing values
INFILE statement example Correct answer-infile "\\net.ucf.edu\Desktop\file.txt" dlm = "," firstobs =
2 missover dsd;
PROC UNIVARIATE Correct answer-used to request a variety of statistics for summarizing the data
distribution of each analysis variable (sample moments, CI, mean, std dev, test for normality,
frequeny counts, etc)
condition in which Shapiro-Wilks test is better Correct answer-when sample size is <=2000 & >6
if-then statement Correct answer-if gender = 'f' then sex = 'female'
else sex = 'male'
DO loops Correct answer-IF expression THEN DO;
1) DO var = start to stop
ex: DO i = 1 to 5; statements; OUTPUT; END;
2) DO var = start to stop by increment
ex: DO i = 1 to 100 by 10; OUTPUT; END;
3) DO var = list;
ex: DO i = 1,2,3,4,5....,6,7; OUTPUT; END;