4. Do counter=1 to 10; Input hecoursefee : comman9. @; End; run;
Correct Answer : Get Lastest Questions and Answer : Explanation: Whenever you want data as soon as read needs to be put in output than you should use explicitly an output statement like in option 1, putting outside the loop is of no use as option 2. And after putting run statement is syntactically wrong. And option 4 you have not used any output statement so it is also wrong.
Question : You have below raw data file which contains cours_name location fee and then location and corresponding fee upto times in each record. Which of the following program can read this file and create 20 observation is SAS data set. Also each observation has course_name, location and fee as show below.
Correct Answer : Get Lastest Questions and Answer : Explanation: You can read this data using trailing @ sign, for each input step. Option 4 is out. Now if we see the data there are 4 observation in each raw record, so we can use loop or explicitly 4 input step. Hence, option 2 is also out, it does not use any loop or 4 time input step. Option 3 is also wrong it uses 3 time loop as well as 4 explicate input step and not correct. Now lets move to option A, which is not using any loop but explicit 4 input step. It read course_name and hold it until next iteration of data step, it means course_name will be read like SAS hold it, next read its location and fee like Mumbai and 4999 and output statement will submit this data, and next input statement will override the location and fee again like Chennai and 3999 but hold the course_name and output it. Until entire record is finished 4 times for a raw record, it will read the data. And as soon as data step finished course_name will be released.
Question : When you read data sequentially which of the following file will create problem ?
Option A: Every three records can make correct observations. Hence, there will be 2 observations.
Option B: Every 4 records can create proper observation, hence there will be 2 observations can be created out of 8 raw records.
Option C: Again every three records can create proper observations. So 2 observation will be created.
Option D: We can try to create proper observation using every two records. However, when we see every even number of record #2 , then each has 2 fields other than record number 6 which has only 1 record. SO based on that we can say that option D cannot be correctly read.