Don't forget to create account on our site to get access to more material made only for free registered user.  
SAS A00-211 Certification SAS A00-212 Certification Questions and Answers SAS A00 240 Certification Material SAS A00-250 Exam Material Certification SAS Packaged Solutions

Question : 5 The following SAS program is submitted:
data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end; run;
The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.
Which one of the following is the result of the above program?

1.    The program fails execution due to data errors.
2.    The program fails execution due to syntax errors.
3.    The program executes with warnings and creates the WORK.TOTALSALES data set.
4.    The program executes without errors or warnings and creates the WORK.TOTALSALES data set.

Correct Answer : 2
Exp : : data monthly (keep = sales);
do i = 1 to 60; sales = i*10; output;
end; run;
data work.totalsales(keep = msales{12} ) ;
set work.monthly (keep = sales);
array msales {12} ;
do i=1 to 12; msales{i} = sales; end; run;
log file:
153 data work.totalsales(keep = msales{12} ) ;
214
23
ERROR 214-322: Variable name { is not valid.
ERROR 23-7: Invalid value for the KEEP option.
23
23
153! data work.totalsales(keep = msales{12} ) ;
214
ERROR 214-322: Variable name 12 is not valid.
153! data work.totalsales(keep = msales{12} ) ;
214
ERROR 214-322: Variable name } is not valid.
Program will run without errors if we change keep = statement as
data work.totalsales(keep = msales1-msales12 ) ;
set work.monthly (keep = sales);
array msales {12} ; do i=1 to 12; msales{i} = sales;
end;run;
we can't use array variables in the keep/drop options because array variables are temporary and available only at the time of execution. we have to mention the name of the variables created by array if required in the keep option

You have no rights to post comments