Answers, Part VI
The SAS results below come from runs on SAS OnDemand with the pilot data. Where an answer describes what DataStep Studio shows on screen, it follows the DataStep Studio manual.
Chapter 20
Section titled “Chapter 20”20-1. 7 rows. Run Step on the PROC SORT runs only that step; F12 opens WORK.AE2, the data set the step just made.
20-2. Yes. PROC SQL writes NOTE: Table WORK.ZERO created, with 0 rows and 1 columns. The text matches the pattern, so the message appears in the Suspicious Log from this run on. Remove the rule again if your team does not want it.
20-3. The listing lines are at most 100 characters wide. ↺ puts the old value back.
Chapter 21
Section titled “Chapter 21”21-1. 77 subjects. That is exactly the group >80 of the age groups: 33 are under 65, 144 are 65 to 80, and 77 are older than 80. The filter >80 keeps ages 81 and above, the same rule as the format.
21-2. 11 records have no ASTDT. All 11 come from SDTM start dates with only a year (AESTDTC has 4 characters). The reference ADAE does not impute a date from a year alone. Chapter 11 shows how the known year still decides whether such an event is treatment emergent.
21-3. The value picker writes a condition such as trta IN ('Placebo', 'Xanomeline High Dose'). Copy it into the program:
PROC FREQ DATA=refadm.adae; WHERE trta IN ('Placebo', 'Xanomeline High Dose'); TABLES trta / NOCUM;RUN;What you should see: Placebo 301 and Xanomeline High Dose 455 records. The WHERE from the viewer works in the program without a change.
Chapter 22
Section titled “Chapter 22”22-1. Type sort and press Tab. Type over have with refadm.adae, press Tab, type over want (for example ae_sorted), press Tab, and type usubjid aedecod over usubjid:
PROC SORT DATA=refadm.adae OUT=ae_sorted; BY usubjid aedecod; RUN;22-2. You should see no change. The book’s programs already follow the house style that Format SAS Program applies. It changes the layout and writes &ads as &ads.; it never changes what the program does.
22-3. Select the two LIBNAME lines, right-click → Save Selection as Keyboard Macro… and type libs. Then libs + Tab in any program writes them.
Chapter 23
Section titled “Chapter 23”23-1. Twice. WORK.AE2 holds two subjects, and FIRST.usubjid = 1 only on the first record of each subject.
23-2. S1 has a DM record and no AE record, so indm = 1 and inae = 0. OUTPUT all; writes it to all, and the third IF writes it to dm_only. It does not go to match. Press F10 and watch the debugger go through the two IF lines.
23-3. Once. Subject 01-701-1015 has one weight record with vsblfl = "Y", so the condition is true for one record.
Chapter 24
Section titled “Chapter 24”24-1. Before next, &nsub is 187: the value from round 1 (MILD), because the PROC SQL of round 2 has not run yet. After next, the PROC SQL has run and &nsub is 130.
24-2. 01-718-1427, with 11 MODERATE treatment-emergent records. dups usubjid lists the keys that occur more than once; the next ones are 01-706-1384 with 10, then three subjects with 7.
24-3. 06_teae.sas has two steps: the PROC SQL that makes teae_n, and a PROC PRINT. Write %pry on a line between them and press F4. The run stops after the PROC SQL. vt teae_n shows its 3 rows, one per treatment, with 65, 77 and 76 subjects. next runs the PROC PRINT, and c ends the run.
Chapter 25
Section titled “Chapter 25”25-1. i takes the values 1 and 2: COUNTW finds two words in SEVERE MILD. The lines inside the loop show ×2. In round 1 sev is SEVERE, in round 2 MILD.
25-2. The check for the BY variables. The line with Variable &v. is not in &data. runs, and the log says ERROR: [COUNT_BY] Variable nosuchvar is not in refadm.adae. The coverage now shows that line as reached.
25-3. The call pane writes %hello(). SAS passes () to open code and stops with ERROR 180-322. Define the macro with an empty parameter list, %MACRO hello();, and the call %hello() is correct.
Chapter 26
Section titled “Chapter 26”26-1. 59580 records and 43 tests in 11 units. CHEMISTRY has 18 tests (ALB to URATE, in g/L, U/L, umol/L and mmol/L), HEMATOLOGY 17, URINALYSIS 5, OTHER 2 (TSH, VITB12), and HBA1C has no category. Some hematology tests and all urinalysis tests have no unit, for example ANISO and COLOR. HBA1C and HCT have the unit 1: a ratio without a dimension.
26-2. 10 records and 8 subjects, the same numbers as in chapter 21. Some of the 8 subjects have more than one severe record; dups usubjid names them.
26-3. It must return -1 and write an ERROR. The test:
%assert_eq(%n_obs(), -1, a call without DATA=)What you should see: ERROR: [N_OBS] DATA= is required. and the test passes.
26-4. It returns -1 with ERROR: [N_OBS] Data set refadm.adsl(WHERE=(saffl = "Y")) does not exist. The macro never reaches OPEN: EXIST() takes a data set name, and the text with the data set option is not a name. Use the parameter for it: %n_obs(data=refadm.adsl, where=%STR(saffl = "Y")) returns 254. A %pry before the EXIST check shows data = refadm.adsl(WHERE=(saffl = "Y")) with ls.