Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program to be wrapped in a macro for Problem B. When the following 5A5 program data numweeksbest; set sta402.weeks_best; by best notsorted; if first.best then

image text in transcribed
Program to be wrapped in a macro for Problem B. When the following 5A5 program data numweeksbest; set sta402.weeks_best; by best notsorted; if first.best then streak=0; streak + 1; if 1ast.best than output; run; is applied to the weeks_best.sas?bdat data set it identifies the length of each streak {number of consecutive equal values) for the values given in the variable best. See the example below. Example illustrating the original program given in Problem B. The data set weeks_best.sas7bdat contains one variable, best, giving the top-ranked organization for each week of a season. Applying the program above to this data set creates a new data set of twelve observations with variables named best and streak. The first three observations in the new data set indicate that Foxville Frogs was the leader for the first 4 weeks, then Muncie Mudflaps led for 1 week, then Hamburg Hares led for 2 weeks, and then Foxville Frogs again for 2 weeks, etc. The first few observations for the original and created data sets are shown below. Original Data Set Obs best Foxvllle Frogs Foxville Frogs Foxvllle Frogs Foxvllle Frogs Muncie Mudflaps} Streak of length 1 Hamburg Hares Hamburg Hares } Streak of length 2 Foxvllle Frogs Envnillh EI'I'LI'II' Streak of length 4 o m u m m e w M H 1* Streak of length 2 Created Date Set Obs best streak 1 Faxville Frogs 4 2 Muncie Mudflaps l 3 Hamburg Hares 2 4 Foxville Frogs 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Mathematics questions