Lora D. Delwiche

Exercises and Projects for The Little SAS Book, Sixth Edition


Скачать книгу

Smoke = 0 AND (Sbp >= 140 OR Dbp >= 90)

      THEN Risk = ‘High’;

      30. Suppose that you have an extremely large data set that contains banking transaction records for branches across the United States, with the majority of records coming from the northeastern states. Your task is to group the records into regions based on the state where the transaction occurred. Discuss how you can accomplish this grouping as efficiently as possible.

      31. Describe one potential pitfall of using an ELSE statement instead of an ELSE IF statement.

      32. How could the following code be rewritten so that it is more efficient? Explain why this might be important with a very large data set and then rewrite the DATA step.

      DATA mtn;

      INFILE ‘c:\MyRawData\UnitedStates.dat’;

      INPUT State $ Pop2000 Pop2010;

      IF State IN (‘Arizona’,’Colorado’,’Idaho’,

      ‘Montana’,’Nevada’,

      ‘New Mexico’,’Utah’,’Wyoming’)

      THEN Region = ‘Mountain’;

      PopDiff = Pop2010 - Pop2000;

      IF Region = ‘Mountain’;

      RUN;

      33. In the following code, the observations will have a value of missing for the variable HeightCM. Explain why, and how to fix this problem.

      DATA femaleheight;

      SET height;

      IF Gender = ‘Female’ THEN OUTPUT;

      HeightCM = HeightIN * 2.54;

      RUN;

      34. In the following code, the data for the 7th, 14th, 21st, and 28th observations in the DETAIL data set are very similar to the resulting observations in the SUMMARY data set. Explain any differences for these observations between the two data sets and why these differences occur.

      DATA summary detail;

      DO Weeks = 1 TO 4;

      DO Days = 1 TO 7;

      Count + 1;

      OUTPUT detail;

      END;

      OUTPUT summary;

      END;

      RUN;

      35. Explain the difference between a DO statement and an iterative DO statement.

      36. In the following code, you were expecting the data set TALLY to have 10 observations, but instead no observations were written. Explain why, and how to fix this problem.

      DATA tally;

      Sum = 0;

      DO WHILE (Sum >= 10);

      Sum + 1;

      OUTPUT;

      END;

      RUN;

      37. Explain why it is useful to use a date format when working with SAS dates.

      Конец ознакомительного фрагмента.

      Текст предоставлен ООО «ЛитРес».

      Прочитайте эту книгу целиком, купив полную легальную версию на ЛитРес.

      Безопасно оплатить книгу можно банковской картой Visa, MasterCard, Maestro, со счета мобильного телефона, с платежного терминала, в салоне МТС или Связной, через PayPal, WebMoney, Яндекс.Деньги, QIWI Кошелек, бонусными картами или другим удобным Вам способом.

/9j/4R0pRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAA agEoAAMAAAABAAIAAAExAAIAAAAeAAAAcgEyAAIAAAAUAAAAkIdpAAQAAAABAAAApAAAANAALcbA AAAnEAAtxsAAACcQQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykAMjAxOTowNzozMSAwODoy ODozMAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAJYKADAAQAAAABAAALkAAAAAAAAAAGAQMAAwAA AAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEAAgAAAgEABAAAAAEAAAEuAgIA BAAAAAEAABvzAAAAAAAAAEgAAAABAAAASAAAAAH/2P/tAAxBZG9iZV9DTQAB/+4ADkFkb2JlAGSA AAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwM