Hi All,
Can anybody elaborate the explanation for the below question please? I believe only one row is read for each month when it's an implicit output.
Hi:
Where you are in doubt about the answer to the quizzes in the class, it's always a good idea to write a program to test the program logic so you can understand exactly what's happening. This is where using the class techniques like PUTLOG will help you. For example, you can write a simple program to make the input bikeinfo file. Then the DATA step is given in the quiz question:
The program runs successfully and in the LOG, you see:
Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:
And the log shows you that 2 observations were read from WORK.BIKEINFO but that 6 observations were written to WORK.BIKEINFO2. If you compare the PUTLOG output to the PROC PRINT, you can see exactly which 6 observations were written out, one for each value of MONTH. You can tell the output was OUTSIDE of the DO loop for WEEK because the value of WEEK is 5, which means that the loop for week had ended and that the OUTPUT happened after week had been incremented from 4 to 5, which ended the WEEK loop.
Hope this helps explain a possible approach to validating the quiz answers in the classes.
Cynthia
The question is not how many values are calculated, but how many OUTPUTs are implemented.
There are two input lines.
There is a loop that runs for each line and outputs 3 times. So 2*3 =6.
This uses an explicit output not implicit.
@Neeharika89 wrote:
Hi All,
Can anybody elaborate the explanation for the below question please? I believe only one row is read for each month when it's an implicit output.
Hi:
Where you are in doubt about the answer to the quizzes in the class, it's always a good idea to write a program to test the program logic so you can understand exactly what's happening. This is where using the class techniques like PUTLOG will help you. For example, you can write a simple program to make the input bikeinfo file. Then the DATA step is given in the quiz question:
The program runs successfully and in the LOG, you see:
Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:
And the log shows you that 2 observations were read from WORK.BIKEINFO but that 6 observations were written to WORK.BIKEINFO2. If you compare the PUTLOG output to the PROC PRINT, you can see exactly which 6 observations were written out, one for each value of MONTH. You can tell the output was OUTSIDE of the DO loop for WEEK because the value of WEEK is 5, which means that the loop for week had ended and that the OUTPUT happened after week had been incremented from 4 to 5, which ended the WEEK loop.
Hope this helps explain a possible approach to validating the quiz answers in the classes.
Cynthia
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.
Find more tutorials on the SAS Users YouTube channel.