BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Neeharika89
Calcite | Level 5

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.

 

Neeharika89_1-1599611391902.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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:

Cynthia_sas_0-1599661606411.png

 

The program runs successfully and in the LOG, you see:

Cynthia_sas_1-1599661707660.png

 

Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:

Cynthia_sas_2-1599661734097.png

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

 

View solution in original post

3 REPLIES 3
mkeintz
PROC Star

The question is not how many values are calculated, but how many OUTPUTs are implemented.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Reeza
Super User

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.

 

Neeharika89_1-1599611391902.png

 


 

Cynthia_sas
SAS Super FREQ

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:

Cynthia_sas_0-1599661606411.png

 

The program runs successfully and in the LOG, you see:

Cynthia_sas_1-1599661707660.png

 

Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:

Cynthia_sas_2-1599661734097.png

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

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
LIBNAME 101

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.

Discussion stats
  • 3 replies
  • 912 views
  • 4 likes
  • 4 in conversation