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?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Click Comment link to get answer
Answer is B.
ReplyDeletedata 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;
syntax error - coz there is no variable as monthsale{12}...the variable is monthsale12
ReplyDeleteAnswer B
ReplyDeletethe answer might be Invalid value for the KEEP option.
ReplyDeletecorrect answer B
ReplyDeleteThe answer is B
ReplyDeleteyap B is correct one bez it is d syntax error
ReplyDeleteans is B...
ReplyDeleteans is B as there is error in the first data step. no proper execution
ReplyDeletethe answer is b syntax errror.
ReplyDeletewe 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.
Answer: b
ReplyDeleteCheck out my latest Base SAS Certification practice question at the link below. If you can answer these questions you can pass the Base SAS Certification!
http://sascert3.blogspot.com/2013/04/base-sas-example-question-61.html
Good luck!
How about (keep=months ales)?
ReplyDeleteWhat is the difference between Data error and Syntax error?
ReplyDeleteI agree that the array causes and error, but this seems like a data error to me, not a syntax error! Can anyone elaborate?
ReplyDelete(Keep=monthsales1-monthsales12) will work.
ReplyDeletewe have to mention the name of the variables created by array if required in the keep option.
ReplyDeleteบาคาร่า
gclub casino
gclub จีคลับ
Thanks for providing this information,Thanks for your sharing.
ReplyDeleteดูหนังออนไลน์
I am grateful for this blog to distribute knowledge about this significant topic. Here I found different segments and now I am going to use these new instructions with new enthusiasm.ระบบขาย
ReplyDeleteThis Is Really Useful And Nices Information. ไฮโล
ReplyDeleteThis are such great articles. ไฮโล This articles can help you to make some new ideas.
https://soccersurfer98.hatenablog.com/entry/2020/09/02/132139?_ga=2.193217001.552343305.1598844608-1286484823.1596077192 I appreciate for reading my blogs.
oh god อเมริกันฟุตบอลthat was amazing article อเมริกันฟุตบอลthis was the of article of the year
ReplyDeleteอเมริกันฟุตบอล I never seen the article like this อเมริกันฟุตบอล I love to see the best article of the year like this I hope to contract with writter for bussiness
อเมริกันฟุตบอล I like this article so much อเมริกันฟุตบอล this topic was awesome อเมริกันฟุตบอล I love to see the tecnique of writer in this post
ReplyDeleteHi, i think that i noticed you visited my web site so i got here to return the prefer?.I am trying to in finding things to enhance my web site!I guess its good enough to use some of your ideas!!
ReplyDelete