BookmarkSubscribeRSS Feed
JackZ295
Pyrite | Level 9

I was working on a homework problem with SAS macros and ran into some issues. Can someone help me troubleshoot the problem? Here is the homework problem: 

 

 

A team of investigators conducted a longitudinal study over 6 study time points (0 months or “baseline”, 2 months, 4 months, 6 months, 8 months, and 10 months) of 100 patients with HIV to examine the relative efficacy of three treatment regimens in increasing CD4 counts: group=1, control; group=2, treatment with one drug per month; group=3, treatment with two drugs per month.  The primary question of interest was to test whether or not the pattern of mean CD4 values over time was different across the 3 study groups.

 

The data is stored in a file called, “hivstudy_sum18.txt”, The data are in the file are arranged with multiple rows per subject in list format in the following order: patient ID; study month; CD4 count; group. 

 

Here is the data from the text file: 

 

1 0 657 1
1 2 548 1
1 4 520 1
1 6 568 1
1 8 389 1
1 10 371 1
2 0 500 1
2 2 419 1
2 4 431 1
2 6 285 1
2 8 270 1
2 10 228 1
3 0 432 1
3 2 586 1
3 4 443 1
3 6 417 1
3 8 380 1
3 10 381 1
4 0 540 1
4 2 545 1
4 4 422 1
4 6 334 1
4 8 381 1
4 10 396 1
5 0 476 1
5 2 484 1
5 4 349 1
5 6 301 1
5 8 181 1
5 10 320 1
6 0 486 1
6 2 448 1
6 4 482 1
6 6 470 1
6 8 452 1
6 10 277 1
7 0 334 1
7 2 311 1
7 4 383 1
7 6 316 1
7 8 190 1
7 10 79 1
8 0 652 1
8 2 462 1
8 4 578 1
8 6 466 1
8 8 328 1
8 10 425 1
9 0 539 1
9 2 465 1
9 4 481 1
9 6 324 1
9 8 323 1
9 10 205 1
10 0 489 1
10 2 416 1
10 4 434 1
10 6 349 1
10 8 242 1
10 10 176 1
11 0 427 1
11 2 349 1
11 4 359 1
11 6 336 1
11 8 290 1
11 10 275 1
12 0 602 1
12 2 392 1
12 4 522 1
12 6 266 1
12 8 351 1
12 10 332 1
13 0 475 1
13 2 426 1
13 4 412 1
13 6 340 1
13 8 315 1
13 10 242 1
14 0 562 1
14 2 421 1
14 4 306 1
14 6 289 1
14 8 337 1
14 10 275 1
15 0 537 1
15 2 425 1
15 4 432 1
15 6 355 1
15 8 352 1
15 10 362 1
16 0 550 1
16 2 508 1
16 4 445 1
16 6 466 1
16 8 324 1
16 10 306 1
17 0 482 1
17 2 395 1
17 4 401 1
17 6 489 1
17 8 398 1
17 10 330 1
18 0 390 1
18 2 477 1
18 4 498 1
18 6 319 1
18 8 329 1
18 10 289 1
19 0 612 1
19 2 531 1
19 4 571 1
19 6 315 1
19 8 309 1
19 10 329 1
20 0 616 1
20 2 536 1
20 4 525 1
20 6 516 1
20 8 565 1
20 10 332 1
21 0 620 1
21 2 507 1
21 4 464 1
21 6 562 1
21 8 472 1
21 10 451 1
22 0 405 1
22 2 346 1
22 4 370 1
22 6 388 1
22 8 307 1
22 10 264 1
23 0 377 1
23 2 419 1
23 4 242 1
23 6 252 1
23 8 129 1
23 10 156 1
24 0 599 1
24 2 482 1
24 4 425 1
24 6 411 1
24 8 362 1
24 10 366 1
25 0 482 1
25 2 470 1
25 4 377 1
25 6 531 1
25 8 348 1
25 10 459 1
26 0 452 1
26 2 340 1
26 4 319 1
26 6 257 1
26 8 302 1
26 10 150 1
27 0 426 1
27 2 398 1
27 4 278 1
27 6 342 1
27 8 276 1
27 10 334 1
28 0 661 1
28 2 490 1
28 4 381 1
28 6 402 1
28 8 405 1
28 10 384 1
29 0 497 1
29 2 527 1
29 4 510 1
29 6 382 1
29 8 407 1
29 10 205 1
30 0 597 1
30 2 530 1
30 4 419 1
30 6 608 1
30 8 439 1
30 10 375 1
31 0 395 1
31 2 474 1
31 4 441 1
31 6 255 1
31 8 327 1
31 10 231 1
32 0 536 1
32 2 605 1
32 4 456 1
32 6 468 1
32 8 468 1
32 10 376 1
33 0 477 1
33 2 394 1
33 4 438 1
33 6 432 1
33 8 266 1
33 10 246 1
34 0 504 1
34 2 696 1
34 4 432 1
34 6 503 1
34 8 429 1
34 10 349 1
35 0 503 1
35 2 390 1
35 4 277 1
35 6 251 1
35 8 275 1
35 10 256 1
36 0 663 1
36 2 561 1
36 4 572 1
36 6 471 1
36 8 477 1
36 10 443 1
37 0 393 1
37 2 373 1
37 4 400 1
37 6 284 1
37 8 284 1
37 10 150 1
38 0 620 1
38 2 714 1
38 4 477 1
38 6 531 1
38 8 401 1
38 10 375 1
39 0 573 1
39 2 435 1
39 4 415 1
39 6 284 1
39 8 356 1
39 10 400 1
40 0 363 1
40 2 423 1
40 4 414 1
40 6 326 1
40 8 234 1
40 10 293 1
41 0 493 2
41 2 467 2
41 4 457 2
41 6 345 2
41 8 337 2
41 10 401 2
42 0 508 2
42 2 515 2
42 4 437 2
42 6 427 2
42 8 581 2
42 10 527 2
43 0 446 2
43 2 458 2
43 4 398 2
43 6 297 2
43 8 370 2
43 10 338 2
44 0 395 2
44 2 372 2
44 4 287 2
44 6 354 2
44 8 356 2
44 10 345 2
45 0 599 2
45 2 566 2
45 4 430 2
45 6 606 2
45 8 510 2
45 10 499 2
46 0 504 2
46 2 514 2
46 4 275 2
46 6 499 2
46 8 467 2
46 10 408 2
47 0 600 2
47 2 595 2
47 4 427 2
47 6 351 2
47 8 492 2
47 10 257 2
48 0 678 2
48 2 553 2
48 4 476 2
48 6 395 2
48 8 542 2
48 10 415 2
49 0 363 2
49 2 172 2
49 4 231 2
49 6 165 2
49 8 214 2
49 10 182 2
50 0 524 2
50 2 324 2
50 4 322 2
50 6 217 2
50 8 337 2
50 10 339 2
51 0 613 2
51 2 436 2
51 4 475 2
51 6 415 2
51 8 595 2
51 10 469 2
52 0 528 2
52 2 459 2
52 4 373 2
52 6 360 2
52 8 333 2
52 10 394 2
53 0 389 2
53 2 361 2
53 4 374 2
53 6 212 2
53 8 253 2
53 10 301 2
54 0 505 2
54 2 510 2
54 4 511 2
54 6 465 2
54 8 427 2
54 10 399 2
55 0 539 2
55 2 478 2
55 4 498 2
55 6 505 2
55 8 563 2
55 10 439 2
56 0 369 2
56 2 377 2
56 4 280 2
56 6 374 2
56 8 253 2
56 10 250 2
57 0 577 2
57 2 610 2
57 4 426 2
57 6 468 2
57 8 471 2
57 10 410 2
58 0 532 2
58 2 374 2
58 4 320 2
58 6 384 2
58 8 236 2
58 10 343 2
59 0 606 2
59 2 553 2
59 4 577 2
59 6 508 2
59 8 533 2
59 10 552 2
60 0 549 2
60 2 536 2
60 4 449 2
60 6 571 2
60 8 450 2
60 10 553 2
61 0 375 2
61 2 560 2
61 4 312 2
61 6 478 2
61 8 357 2
61 10 403 2
62 0 549 2
62 2 510 2
62 4 427 2
62 6 416 2
62 8 253 2
62 10 388 2
63 0 437 2
63 2 458 2
63 4 397 2
63 6 381 2
63 8 356 2
63 10 443 2
64 0 529 2
64 2 542 2
64 4 457 2
64 6 457 2
64 8 462 2
64 10 538 2
65 0 636 2
65 2 521 2
65 4 562 2
65 6 554 2
65 8 462 2
65 10 432 2
66 0 575 2
66 2 519 2
66 4 421 2
66 6 406 2
66 8 488 2
66 10 425 2
67 0 512 2
67 2 442 2
67 4 506 2
67 6 430 2
67 8 410 2
67 10 550 2
68 0 441 2
68 2 413 2
68 4 363 2
68 6 438 2
68 8 350 2
68 10 465 2
69 0 511 2
69 2 393 2
69 4 362 2
69 6 335 2
69 8 316 2
69 10 239 2
70 0 456 2
70 2 508 2
70 4 502 2
70 6 529 2
70 8 421 2
70 10 366 2
71 0 541 2
71 2 454 2
71 4 469 2
71 6 575 2
71 8 611 2
71 10 456 2
72 0 520 2
72 2 479 2
72 4 309 2
72 6 382 2
72 8 434 2
72 10 326 2
73 0 416 2
73 2 480 2
73 4 570 2
73 6 420 2
73 8 425 2
73 10 430 2
74 0 384 2
74 2 360 2
74 4 276 2
74 6 318 2
74 8 337 2
74 10 391 2
75 0 513 2
75 2 550 2
75 4 423 2
75 6 631 2
75 8 446 2
75 10 445 2
76 0 588 2
76 2 529 2
76 4 518 2
76 6 505 2
76 8 609 2
76 10 566 2
77 0 516 2
77 2 486 2
77 4 436 2
77 6 529 2
77 8 366 2
77 10 472 2
78 0 623 2
78 2 431 2
78 4 642 2
78 6 503 2
78 8 466 2
78 10 484 2
79 0 769 2
79 2 536 2
79 4 463 2
79 6 526 2
79 8 504 2
79 10 484 2
80 0 651 2
80 2 486 2
80 4 350 2
80 6 388 2
80 8 504 2
80 10 441 2
81 0 459 3
81 2 419 3
81 4 365 3
81 6 345 3
81 8 292 3
81 10 494 3
82 0 449 3
82 2 401 3
82 4 456 3
82 6 319 3
82 8 423 3
82 10 389 3
83 0 443 3
83 2 435 3
83 4 399 3
83 6 461 3
83 8 559 3
83 10 421 3
84 0 550 3
84 2 440 3
84 4 539 3
84 6 481 3
84 8 512 3
84 10 561 3
85 0 504 3
85 2 545 3
85 4 479 3
85 6 423 3
85 8 464 3
85 10 537 3
86 0 451 3
86 2 495 3
86 4 369 3
86 6 411 3
86 8 439 3
86 10 529 3
87 0 520 3
87 2 535 3
87 4 482 3
87 6 490 3
87 8 326 3
87 10 381 3
88 0 560 3
88 2 650 3
88 4 404 3
88 6 548 3
88 8 598 3
88 10 566 3
89 0 363 3
89 2 345 3
89 4 328 3
89 6 332 3
89 8 326 3
89 10 499 3
90 0 503 3
90 2 342 3
90 4 322 3
90 6 333 3
90 8 270 3
90 10 350 3
91 0 416 3
91 2 435 3
91 4 381 3
91 6 345 3
91 8 297 3
91 10 398 3
92 0 526 3
92 2 485 3
92 4 386 3
92 6 386 3
92 8 478 3
92 10 451 3
93 0 532 3
93 2 596 3
93 4 393 3
93 6 526 3
93 8 557 3
93 10 652 3
94 0 489 3
94 2 418 3
94 4 519 3
94 6 314 3
94 8 506 3
94 10 496 3
95 0 602 3
95 2 513 3
95 4 469 3
95 6 459 3
95 8 421 3
95 10 518 3
96 0 555 3
96 2 406 3
96 4 396 3
96 6 402 3
96 8 459 3
96 10 408 3
97 0 589 3
97 2 435 3
97 4 460 3
97 6 430 3
97 8 390 3
97 10 499 3
98 0 479 3
98 2 401 3
98 4 380 3
98 6 440 3
98 8 534 3
98 10 562 3
99 0 621 3
99 2 574 3
99 4 374 3
99 6 548 3
99 8 535 3
99 10 510 3
100 0 536 3
100 2 532 3
100 4 382 3
100 6 431 3
100 8 426 3
100 10 471 3
101 0 420 3
101 2 329 3
101 4 424 3
101 6 281 3
101 8 481 3
101 10 421 3
102 0 427 3
102 2 522 3
102 4 409 3
102 6 438 3
102 8 424 3
102 10 594 3
103 0 519 3
103 2 459 3
103 4 561 3
103 6 423 3
103 8 517 3
103 10 577 3
104 0 624 3
104 2 549 3
104 4 495 3
104 6 560 3
104 8 528 3
104 10 582 3
105 0 535 3
105 2 567 3
105 4 412 3
105 6 446 3
105 8 574 3
105 10 488 3
106 0 595 3
106 2 508 3
106 4 499 3
106 6 524 3
106 8 663 3
106 10 690 3
107 0 546 3
107 2 630 3
107 4 646 3
107 6 536 3
107 8 613 3
107 10 500 3
108 0 447 3
108 2 415 3
108 4 399 3
108 6 204 3
108 8 344 3
108 10 366 3
109 0 658 3
109 2 452 3
109 4 511 3
109 6 575 3
109 8 581 3
109 10 614 3
110 0 610 3
110 2 442 3
110 4 473 3
110 6 459 3
110 8 517 3
110 10 566 3
111 0 543 3
111 2 522 3
111 4 438 3
111 6 397 3
111 8 447 3
111 10 371 3
112 0 490 3
112 2 470 3
112 4 402 3
112 6 297 3
112 8 516 3
112 10 437 3
113 0 536 3
113 2 407 3
113 4 409 3
113 6 489 3
113 8 481 3
113 10 419 3
114 0 528 3
114 2 563 3
114 4 498 3
114 6 585 3
114 8 528 3
114 10 552 3
115 0 522 3
115 2 474 3
115 4 413 3
115 6 478 3
115 8 409 3
115 10 429 3
116 0 595 3
116 2 448 3
116 4 297 3
116 6 348 3
116 8 487 3
116 10 570 3
117 0 410 3
117 2 499 3
117 4 507 3
117 6 491 3
117 8 478 3
117 10 526 3
118 0 388 3
118 2 364 3
118 4 392 3
118 6 360 3
118 8 341 3
118 10 476 3
119 0 464 3
119 2 403 3
119 4 428 3
119 6 408 3
119 8 426 3
119 10 479 3
120 0 523 3
120 2 520 3
120 4 432 3
120 6 552 3
120 8 640 3
120 10 551 3

Here is the specific homework question I had issues on: 

 

Write and execute a SAS macro to generate models for the interaction of study month as a continuous variable and treatment group that use generalized estimating equations (GEE) in SAS for CD4 count as a continuous, dependent variable employing four different working correlation structures: independence (IND); exchangeable (EXCH); autoregressive-1 (AR(1)); and unstructured (UNSTR).

 

Here is my code for this particular problem: 

 

filename HW12 'C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt';
*Part A: Reading in Data; 
proc format; 
    value grpf 0='control group' 1='one drug per month' 2='two drugs per month'; 
run; 
data one; 
    infile HW12; 
    input id month CD4 grp @@; 
label id='Patient ID'
      month='Study Month'
      CD4='CD4 Count'
      grp='Study Group';
run; 
*Printout of Dataset One;
title 'Printout of Dataset One'; 
proc print data=one; 
    run; 
%macro exper(datain,idm, monthm, grpm, CD4m);
proc sort data=&datain;
    by &idm &grpm; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=ar(1) corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=IND corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=EXCH corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=UNSTR corrw; 
run; 
%mend exper; 
%exper(one, id, month, grp, CD4); 

 When I ran this code, I received these errors: 

 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
      Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70009029.
NOTE: This session is executing on the W32_10HOME  platform.



NOTE: Updated analytical products:

      SAS/STAT 14.3
      SAS/ETS 14.3
      SAS/OR 14.3
      SAS/IML 14.3
      SAS/QC 14.3

NOTE: Additional host information:

 W32_10HOME WIN 10.0.17134  Workstation

NOTE: SAS initialization used:
      real time           1.19 seconds
      cpu time            1.12 seconds

1    filename HW12 'C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt';
2    *Part A: Reading in Data;
3    proc format;
4        value grpf 0='control group' 1='one drug per month' 2='two drugs per month';
NOTE: Format GRPF has been output.
5    run;

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds


6    data one;
7        infile HW12;
8        input id month CD4 grp @@;
9    label id='Patient ID'
10         month='Study Month'
11         CD4='CD4 Count'
12         grp='Study Group';
13   run;

NOTE: The infile HW12 is:
      Filename=C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt,
      RECFM=V,LRECL=32767,File Size (bytes)=12238,
      Last Modified=11Jul2018:15:45:15,
      Create Time=11Jul2018:15:45:15

NOTE: 720 records were read from the infile HW12.
      The minimum record length was 15.
      The maximum record length was 15.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.ONE has 720 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


14   *Printout of Dataset One;
15   title 'Printout of Dataset One';
16   proc print data=one;
NOTE: Writing HTML Body file: sashtml.htm
17       run;

NOTE: There were 720 observations read from the data set WORK.ONE.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.42 seconds
      cpu time            0.20 seconds


18   %macro exper(datain,idm, monthm, grpm, CD4m);
19   proc sort data=&datain;
20       by &idm &grpm;
21   run;
22   proc genmod data=&datain order=freq;
23   class &grpm &monthm &idm;
24   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
25   repeated subject=&idm/ within=&grp type=ar(1) corrw;
26   run;
27   proc genmod data=&datain order=freq;
28   class &grpm &monthm &idm;
29   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
30   repeated subject=&idm/ within=&grp type=IND corrw;
31   run;
32   proc genmod data=&datain order=freq;
33   class &grpm &monthm &idm;
34   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
35   repeated subject=&idm/ within=&grp type=EXCH corrw;
36   run;
37   proc genmod data=&datain order=freq;
38   class &grpm &monthm &idm;
39   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
40   repeated subject=&idm/ within=&grp type=UNSTR corrw;
41   run;
42   %mend exper;
43   %exper(one, id, month, grp, CD4);

NOTE: There were 720 observations read from the data set WORK.ONE.
NOTE: The data set WORK.ONE has 720 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


NOTE 137-205: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            22
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            200
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


NOTE 137-205: Line generated by the invoked macro "EXPER".
2     class &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
2  ! subject=&idm/ within=&grp type=IND corrw; run; proc genmod data=&datain order=freq; class
                          -
                          22
2  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
2     class &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
2  ! subject=&idm/ within=&grp type=IND corrw; run; proc genmod data=&datain order=freq; class
                          -
                          200
2  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


NOTE: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run;
                           -
                           22
                           200
WARNING: Apparent symbolic reference GRP not resolved.

ERROR 22-322: Expecting a name.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds



NOTE 137-205: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run; proc genmod data=&datain order=freq; class
3  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
3  ! within=&grp type=UNSTR corrw; run;
            -
            22
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run; proc genmod data=&datain order=freq; class
3  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
3  ! within=&grp type=UNSTR corrw; run;
            -
            200
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds

Can someone provide some hints as to where I went wrong? Thanks!  

4 REPLIES 4
ballardw
Super User

You want to learn a couple of tools for working with macros. You will get better debugging if setting some options prior to running a macro (and then turning them off). The two most commonly helpful are MPRINT and SYMBOLGEN for determining what code text s being created by the macro. Another is MLOGIC to see the results of macro logic tests.

 

Example:

Options mprint symbolgen;

 %exper(one, id, month, grp, CD4);

Options nomprint nosymbolgen;

 

With that out of the way, examine:

%macro exper(datain,idm, monthm, grpm, CD4m);
proc sort data=&datain;
    by &idm &grpm; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=ar(1) corrw; 
run; 

You are using a macro variable &grp without defining it. If you are meaning to use the DATASET variable GRP then remove the & from all of the &grp (not the &grpm which you do define). If you mean that to be &grpm then make the spelling change.

 

 

If you had run the code with the MPRINT option you would have seen that the generated code looked something like:

repeated subject=id/  within= type=ar(1) corrw;

Which why the error is expected name. No value for the &grp meant no data set variable was used with the WITHIN= option.

Tom
Super User Tom
Super User

The error message seems pretty clear to me

NOTE 137-205: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            22
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            200
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

The macro processor is complaining that the macro variable GRP is not defined.

And SAS is complaining that WITHIN=&grp is invalid syntax for the REPEATED statement of PROC GENMOD.

Reeza
Super User

Your macro variable is missing the M. 

 

The last one should be &grpM not &grp. 

 

%macro exper(datain,idm, monthm, grpm, CD4m);
proc sort data=&datain;
    by &idm &grpm; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=ar(1) corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=IND corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=EXCH corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=UNSTR corrw; 
run; 
%mend exper; 

@JackZ295 wrote:

I was working on a homework problem with SAS macros and ran into some issues. Can someone help me troubleshoot the problem? Here is the homework problem: 

 

 

A team of investigators conducted a longitudinal study over 6 study time points (0 months or “baseline”, 2 months, 4 months, 6 months, 8 months, and 10 months) of 100 patients with HIV to examine the relative efficacy of three treatment regimens in increasing CD4 counts: group=1, control; group=2, treatment with one drug per month; group=3, treatment with two drugs per month.  The primary question of interest was to test whether or not the pattern of mean CD4 values over time was different across the 3 study groups.

 

The data is stored in a file called, “hivstudy_sum18.txt”, The data are in the file are arranged with multiple rows per subject in list format in the following order: patient ID; study month; CD4 count; group. 

 

Here is the data from the text file: 

 

1 0 657 1
1 2 548 1
1 4 520 1
1 6 568 1
1 8 389 1
1 10 371 1
2 0 500 1
2 2 419 1
2 4 431 1
2 6 285 1
2 8 270 1
2 10 228 1
3 0 432 1
3 2 586 1
3 4 443 1
3 6 417 1
3 8 380 1
3 10 381 1
4 0 540 1
4 2 545 1
4 4 422 1
4 6 334 1
4 8 381 1
4 10 396 1
5 0 476 1
5 2 484 1
5 4 349 1
5 6 301 1
5 8 181 1
5 10 320 1
6 0 486 1
6 2 448 1
6 4 482 1
6 6 470 1
6 8 452 1
6 10 277 1
7 0 334 1
7 2 311 1
7 4 383 1
7 6 316 1
7 8 190 1
7 10 79 1
8 0 652 1
8 2 462 1
8 4 578 1
8 6 466 1
8 8 328 1
8 10 425 1
9 0 539 1
9 2 465 1
9 4 481 1
9 6 324 1
9 8 323 1
9 10 205 1
10 0 489 1
10 2 416 1
10 4 434 1
10 6 349 1
10 8 242 1
10 10 176 1
11 0 427 1
11 2 349 1
11 4 359 1
11 6 336 1
11 8 290 1
11 10 275 1
12 0 602 1
12 2 392 1
12 4 522 1
12 6 266 1
12 8 351 1
12 10 332 1
13 0 475 1
13 2 426 1
13 4 412 1
13 6 340 1
13 8 315 1
13 10 242 1
14 0 562 1
14 2 421 1
14 4 306 1
14 6 289 1
14 8 337 1
14 10 275 1
15 0 537 1
15 2 425 1
15 4 432 1
15 6 355 1
15 8 352 1
15 10 362 1
16 0 550 1
16 2 508 1
16 4 445 1
16 6 466 1
16 8 324 1
16 10 306 1
17 0 482 1
17 2 395 1
17 4 401 1
17 6 489 1
17 8 398 1
17 10 330 1
18 0 390 1
18 2 477 1
18 4 498 1
18 6 319 1
18 8 329 1
18 10 289 1
19 0 612 1
19 2 531 1
19 4 571 1
19 6 315 1
19 8 309 1
19 10 329 1
20 0 616 1
20 2 536 1
20 4 525 1
20 6 516 1
20 8 565 1
20 10 332 1
21 0 620 1
21 2 507 1
21 4 464 1
21 6 562 1
21 8 472 1
21 10 451 1
22 0 405 1
22 2 346 1
22 4 370 1
22 6 388 1
22 8 307 1
22 10 264 1
23 0 377 1
23 2 419 1
23 4 242 1
23 6 252 1
23 8 129 1
23 10 156 1
24 0 599 1
24 2 482 1
24 4 425 1
24 6 411 1
24 8 362 1
24 10 366 1
25 0 482 1
25 2 470 1
25 4 377 1
25 6 531 1
25 8 348 1
25 10 459 1
26 0 452 1
26 2 340 1
26 4 319 1
26 6 257 1
26 8 302 1
26 10 150 1
27 0 426 1
27 2 398 1
27 4 278 1
27 6 342 1
27 8 276 1
27 10 334 1
28 0 661 1
28 2 490 1
28 4 381 1
28 6 402 1
28 8 405 1
28 10 384 1
29 0 497 1
29 2 527 1
29 4 510 1
29 6 382 1
29 8 407 1
29 10 205 1
30 0 597 1
30 2 530 1
30 4 419 1
30 6 608 1
30 8 439 1
30 10 375 1
31 0 395 1
31 2 474 1
31 4 441 1
31 6 255 1
31 8 327 1
31 10 231 1
32 0 536 1
32 2 605 1
32 4 456 1
32 6 468 1
32 8 468 1
32 10 376 1
33 0 477 1
33 2 394 1
33 4 438 1
33 6 432 1
33 8 266 1
33 10 246 1
34 0 504 1
34 2 696 1
34 4 432 1
34 6 503 1
34 8 429 1
34 10 349 1
35 0 503 1
35 2 390 1
35 4 277 1
35 6 251 1
35 8 275 1
35 10 256 1
36 0 663 1
36 2 561 1
36 4 572 1
36 6 471 1
36 8 477 1
36 10 443 1
37 0 393 1
37 2 373 1
37 4 400 1
37 6 284 1
37 8 284 1
37 10 150 1
38 0 620 1
38 2 714 1
38 4 477 1
38 6 531 1
38 8 401 1
38 10 375 1
39 0 573 1
39 2 435 1
39 4 415 1
39 6 284 1
39 8 356 1
39 10 400 1
40 0 363 1
40 2 423 1
40 4 414 1
40 6 326 1
40 8 234 1
40 10 293 1
41 0 493 2
41 2 467 2
41 4 457 2
41 6 345 2
41 8 337 2
41 10 401 2
42 0 508 2
42 2 515 2
42 4 437 2
42 6 427 2
42 8 581 2
42 10 527 2
43 0 446 2
43 2 458 2
43 4 398 2
43 6 297 2
43 8 370 2
43 10 338 2
44 0 395 2
44 2 372 2
44 4 287 2
44 6 354 2
44 8 356 2
44 10 345 2
45 0 599 2
45 2 566 2
45 4 430 2
45 6 606 2
45 8 510 2
45 10 499 2
46 0 504 2
46 2 514 2
46 4 275 2
46 6 499 2
46 8 467 2
46 10 408 2
47 0 600 2
47 2 595 2
47 4 427 2
47 6 351 2
47 8 492 2
47 10 257 2
48 0 678 2
48 2 553 2
48 4 476 2
48 6 395 2
48 8 542 2
48 10 415 2
49 0 363 2
49 2 172 2
49 4 231 2
49 6 165 2
49 8 214 2
49 10 182 2
50 0 524 2
50 2 324 2
50 4 322 2
50 6 217 2
50 8 337 2
50 10 339 2
51 0 613 2
51 2 436 2
51 4 475 2
51 6 415 2
51 8 595 2
51 10 469 2
52 0 528 2
52 2 459 2
52 4 373 2
52 6 360 2
52 8 333 2
52 10 394 2
53 0 389 2
53 2 361 2
53 4 374 2
53 6 212 2
53 8 253 2
53 10 301 2
54 0 505 2
54 2 510 2
54 4 511 2
54 6 465 2
54 8 427 2
54 10 399 2
55 0 539 2
55 2 478 2
55 4 498 2
55 6 505 2
55 8 563 2
55 10 439 2
56 0 369 2
56 2 377 2
56 4 280 2
56 6 374 2
56 8 253 2
56 10 250 2
57 0 577 2
57 2 610 2
57 4 426 2
57 6 468 2
57 8 471 2
57 10 410 2
58 0 532 2
58 2 374 2
58 4 320 2
58 6 384 2
58 8 236 2
58 10 343 2
59 0 606 2
59 2 553 2
59 4 577 2
59 6 508 2
59 8 533 2
59 10 552 2
60 0 549 2
60 2 536 2
60 4 449 2
60 6 571 2
60 8 450 2
60 10 553 2
61 0 375 2
61 2 560 2
61 4 312 2
61 6 478 2
61 8 357 2
61 10 403 2
62 0 549 2
62 2 510 2
62 4 427 2
62 6 416 2
62 8 253 2
62 10 388 2
63 0 437 2
63 2 458 2
63 4 397 2
63 6 381 2
63 8 356 2
63 10 443 2
64 0 529 2
64 2 542 2
64 4 457 2
64 6 457 2
64 8 462 2
64 10 538 2
65 0 636 2
65 2 521 2
65 4 562 2
65 6 554 2
65 8 462 2
65 10 432 2
66 0 575 2
66 2 519 2
66 4 421 2
66 6 406 2
66 8 488 2
66 10 425 2
67 0 512 2
67 2 442 2
67 4 506 2
67 6 430 2
67 8 410 2
67 10 550 2
68 0 441 2
68 2 413 2
68 4 363 2
68 6 438 2
68 8 350 2
68 10 465 2
69 0 511 2
69 2 393 2
69 4 362 2
69 6 335 2
69 8 316 2
69 10 239 2
70 0 456 2
70 2 508 2
70 4 502 2
70 6 529 2
70 8 421 2
70 10 366 2
71 0 541 2
71 2 454 2
71 4 469 2
71 6 575 2
71 8 611 2
71 10 456 2
72 0 520 2
72 2 479 2
72 4 309 2
72 6 382 2
72 8 434 2
72 10 326 2
73 0 416 2
73 2 480 2
73 4 570 2
73 6 420 2
73 8 425 2
73 10 430 2
74 0 384 2
74 2 360 2
74 4 276 2
74 6 318 2
74 8 337 2
74 10 391 2
75 0 513 2
75 2 550 2
75 4 423 2
75 6 631 2
75 8 446 2
75 10 445 2
76 0 588 2
76 2 529 2
76 4 518 2
76 6 505 2
76 8 609 2
76 10 566 2
77 0 516 2
77 2 486 2
77 4 436 2
77 6 529 2
77 8 366 2
77 10 472 2
78 0 623 2
78 2 431 2
78 4 642 2
78 6 503 2
78 8 466 2
78 10 484 2
79 0 769 2
79 2 536 2
79 4 463 2
79 6 526 2
79 8 504 2
79 10 484 2
80 0 651 2
80 2 486 2
80 4 350 2
80 6 388 2
80 8 504 2
80 10 441 2
81 0 459 3
81 2 419 3
81 4 365 3
81 6 345 3
81 8 292 3
81 10 494 3
82 0 449 3
82 2 401 3
82 4 456 3
82 6 319 3
82 8 423 3
82 10 389 3
83 0 443 3
83 2 435 3
83 4 399 3
83 6 461 3
83 8 559 3
83 10 421 3
84 0 550 3
84 2 440 3
84 4 539 3
84 6 481 3
84 8 512 3
84 10 561 3
85 0 504 3
85 2 545 3
85 4 479 3
85 6 423 3
85 8 464 3
85 10 537 3
86 0 451 3
86 2 495 3
86 4 369 3
86 6 411 3
86 8 439 3
86 10 529 3
87 0 520 3
87 2 535 3
87 4 482 3
87 6 490 3
87 8 326 3
87 10 381 3
88 0 560 3
88 2 650 3
88 4 404 3
88 6 548 3
88 8 598 3
88 10 566 3
89 0 363 3
89 2 345 3
89 4 328 3
89 6 332 3
89 8 326 3
89 10 499 3
90 0 503 3
90 2 342 3
90 4 322 3
90 6 333 3
90 8 270 3
90 10 350 3
91 0 416 3
91 2 435 3
91 4 381 3
91 6 345 3
91 8 297 3
91 10 398 3
92 0 526 3
92 2 485 3
92 4 386 3
92 6 386 3
92 8 478 3
92 10 451 3
93 0 532 3
93 2 596 3
93 4 393 3
93 6 526 3
93 8 557 3
93 10 652 3
94 0 489 3
94 2 418 3
94 4 519 3
94 6 314 3
94 8 506 3
94 10 496 3
95 0 602 3
95 2 513 3
95 4 469 3
95 6 459 3
95 8 421 3
95 10 518 3
96 0 555 3
96 2 406 3
96 4 396 3
96 6 402 3
96 8 459 3
96 10 408 3
97 0 589 3
97 2 435 3
97 4 460 3
97 6 430 3
97 8 390 3
97 10 499 3
98 0 479 3
98 2 401 3
98 4 380 3
98 6 440 3
98 8 534 3
98 10 562 3
99 0 621 3
99 2 574 3
99 4 374 3
99 6 548 3
99 8 535 3
99 10 510 3
100 0 536 3
100 2 532 3
100 4 382 3
100 6 431 3
100 8 426 3
100 10 471 3
101 0 420 3
101 2 329 3
101 4 424 3
101 6 281 3
101 8 481 3
101 10 421 3
102 0 427 3
102 2 522 3
102 4 409 3
102 6 438 3
102 8 424 3
102 10 594 3
103 0 519 3
103 2 459 3
103 4 561 3
103 6 423 3
103 8 517 3
103 10 577 3
104 0 624 3
104 2 549 3
104 4 495 3
104 6 560 3
104 8 528 3
104 10 582 3
105 0 535 3
105 2 567 3
105 4 412 3
105 6 446 3
105 8 574 3
105 10 488 3
106 0 595 3
106 2 508 3
106 4 499 3
106 6 524 3
106 8 663 3
106 10 690 3
107 0 546 3
107 2 630 3
107 4 646 3
107 6 536 3
107 8 613 3
107 10 500 3
108 0 447 3
108 2 415 3
108 4 399 3
108 6 204 3
108 8 344 3
108 10 366 3
109 0 658 3
109 2 452 3
109 4 511 3
109 6 575 3
109 8 581 3
109 10 614 3
110 0 610 3
110 2 442 3
110 4 473 3
110 6 459 3
110 8 517 3
110 10 566 3
111 0 543 3
111 2 522 3
111 4 438 3
111 6 397 3
111 8 447 3
111 10 371 3
112 0 490 3
112 2 470 3
112 4 402 3
112 6 297 3
112 8 516 3
112 10 437 3
113 0 536 3
113 2 407 3
113 4 409 3
113 6 489 3
113 8 481 3
113 10 419 3
114 0 528 3
114 2 563 3
114 4 498 3
114 6 585 3
114 8 528 3
114 10 552 3
115 0 522 3
115 2 474 3
115 4 413 3
115 6 478 3
115 8 409 3
115 10 429 3
116 0 595 3
116 2 448 3
116 4 297 3
116 6 348 3
116 8 487 3
116 10 570 3
117 0 410 3
117 2 499 3
117 4 507 3
117 6 491 3
117 8 478 3
117 10 526 3
118 0 388 3
118 2 364 3
118 4 392 3
118 6 360 3
118 8 341 3
118 10 476 3
119 0 464 3
119 2 403 3
119 4 428 3
119 6 408 3
119 8 426 3
119 10 479 3
120 0 523 3
120 2 520 3
120 4 432 3
120 6 552 3
120 8 640 3
120 10 551 3

Here is the specific homework question I had issues on: 

 

Write and execute a SAS macro to generate models for the interaction of study month as a continuous variable and treatment group that use generalized estimating equations (GEE) in SAS for CD4 count as a continuous, dependent variable employing four different working correlation structures: independence (IND); exchangeable (EXCH); autoregressive-1 (AR(1)); and unstructured (UNSTR).

 

Here is my code for this particular problem: 

 

filename HW12 'C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt';
*Part A: Reading in Data; 
proc format; 
    value grpf 0='control group' 1='one drug per month' 2='two drugs per month'; 
run; 
data one; 
    infile HW12; 
    input id month CD4 grp @@; 
label id='Patient ID'
      month='Study Month'
      CD4='CD4 Count'
      grp='Study Group';
run; 
*Printout of Dataset One;
title 'Printout of Dataset One'; 
proc print data=one; 
    run; 
%macro exper(datain,idm, monthm, grpm, CD4m);
proc sort data=&datain;
    by &idm &grpm; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=ar(1) corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=IND corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=EXCH corrw; 
run; 
proc genmod data=&datain order=freq; 
class &grpm &monthm &idm; 
model &CD4m=&monthm &grpm &grpm*&monthm/type3; 
repeated subject=&idm/ within=&grp type=UNSTR corrw; 
run; 
%mend exper; 
%exper(one, id, month, grp, CD4); 

 When I ran this code, I received these errors: 

 

NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
      Licensed to BOSTON UNIVERSITY - SFA T&R, Site 70009029.
NOTE: This session is executing on the W32_10HOME  platform.



NOTE: Updated analytical products:

      SAS/STAT 14.3
      SAS/ETS 14.3
      SAS/OR 14.3
      SAS/IML 14.3
      SAS/QC 14.3

NOTE: Additional host information:

 W32_10HOME WIN 10.0.17134  Workstation

NOTE: SAS initialization used:
      real time           1.19 seconds
      cpu time            1.12 seconds

1    filename HW12 'C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt';
2    *Part A: Reading in Data;
3    proc format;
4        value grpf 0='control group' 1='one drug per month' 2='two drugs per month';
NOTE: Format GRPF has been output.
5    run;

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds


6    data one;
7        infile HW12;
8        input id month CD4 grp @@;
9    label id='Patient ID'
10         month='Study Month'
11         CD4='CD4 Count'
12         grp='Study Group';
13   run;

NOTE: The infile HW12 is:
      Filename=C:\Users\jackz\Desktop\SAS\hivstudy_sum18.txt,
      RECFM=V,LRECL=32767,File Size (bytes)=12238,
      Last Modified=11Jul2018:15:45:15,
      Create Time=11Jul2018:15:45:15

NOTE: 720 records were read from the infile HW12.
      The minimum record length was 15.
      The maximum record length was 15.
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.ONE has 720 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


14   *Printout of Dataset One;
15   title 'Printout of Dataset One';
16   proc print data=one;
NOTE: Writing HTML Body file: sashtml.htm
17       run;

NOTE: There were 720 observations read from the data set WORK.ONE.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.42 seconds
      cpu time            0.20 seconds


18   %macro exper(datain,idm, monthm, grpm, CD4m);
19   proc sort data=&datain;
20       by &idm &grpm;
21   run;
22   proc genmod data=&datain order=freq;
23   class &grpm &monthm &idm;
24   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
25   repeated subject=&idm/ within=&grp type=ar(1) corrw;
26   run;
27   proc genmod data=&datain order=freq;
28   class &grpm &monthm &idm;
29   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
30   repeated subject=&idm/ within=&grp type=IND corrw;
31   run;
32   proc genmod data=&datain order=freq;
33   class &grpm &monthm &idm;
34   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
35   repeated subject=&idm/ within=&grp type=EXCH corrw;
36   run;
37   proc genmod data=&datain order=freq;
38   class &grpm &monthm &idm;
39   model &CD4m=&monthm &grpm &grpm*&monthm/type3;
40   repeated subject=&idm/ within=&grp type=UNSTR corrw;
41   run;
42   %mend exper;
43   %exper(one, id, month, grp, CD4);

NOTE: There were 720 observations read from the data set WORK.ONE.
NOTE: The data set WORK.ONE has 720 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


NOTE 137-205: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            22
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
1     proc sort data=&datain;     by &idm &grpm; run; proc genmod data=&datain order=freq; class
1  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
1  ! within=&grp type=ar(1) corrw; run; proc genmod data=&datain order=freq;
            -
            200
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


NOTE 137-205: Line generated by the invoked macro "EXPER".
2     class &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
2  ! subject=&idm/ within=&grp type=IND corrw; run; proc genmod data=&datain order=freq; class
                          -
                          22
2  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
2     class &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
2  ! subject=&idm/ within=&grp type=IND corrw; run; proc genmod data=&datain order=freq; class
                          -
                          200
2  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


NOTE: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run;
                           -
                           22
                           200
WARNING: Apparent symbolic reference GRP not resolved.

ERROR 22-322: Expecting a name.

ERROR 200-322: The symbol is not recognized and will be ignored.


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds



NOTE 137-205: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run; proc genmod data=&datain order=freq; class
3  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
3  ! within=&grp type=UNSTR corrw; run;
            -
            22
ERROR 22-322: Expecting a name.

NOTE: Line generated by the invoked macro "EXPER".
3     subject=&idm/ within=&grp type=EXCH corrw; run; proc genmod data=&datain order=freq; class
3  ! &grpm &monthm &idm; model &CD4m=&monthm &grpm &grpm*&monthm/type3; repeated subject=&idm/
3  ! within=&grp type=UNSTR corrw; run;
            -
            200
ERROR 200-322: The symbol is not recognized and will be ignored.

WARNING: Apparent symbolic reference GRP not resolved.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds

Can someone provide some hints as to where I went wrong? Thanks!  


 

LinusH
Tourmaline | Level 20
First you should get help on homework by the one that gave you the homework.
The the message IMO quite clear. GRP hasn't been given a value. Why is up to you to figure out.
Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 379 views
  • 0 likes
  • 5 in conversation