1 The SAS System 18:27 Sunday, May 1, 2022
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Program';
4 %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';
5 %LET _CLIENTPROJECTPATH='';
6 %LET _CLIENTPROJECTPATHHOST='';
7 %LET _CLIENTPROJECTNAME='';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=SVG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 %macro HTML5AccessibleGraphSupported;
15 %if %_SAS_VERCOMP(9, 4, 4) >= 0 %then ACCESSIBLE_GRAPH;
16 %mend;
17 FILENAME EGHTML TEMP;
18 ODS HTML5(ID=EGHTML) FILE=EGHTML
19 OPTIONS(BITMAP_MODE='INLINE')
20 %HTML5AccessibleGraphSupported
21 ENCODING='utf-8'
22 STYLE=HtmlBlue
23 NOGTITLE
24 NOGFOOTNOTE
25 GPATH=&sasworklocation
26 ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
27
28 %let nobs=100;
29 %let nboot=200;
30
31 data weight_1;
32 do i=1 to &nobs.;
33 output;
34 end;
35 run;
NOTE: The data set WORK.WEIGHT_1 has 100 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
36
37
38 data weight_2;
39 set weight_1 end=lastobs;
40 call streaminit (1293);
41 do n=1 to &nboot.;
42
43 array R [&nobs.] _temporary_;
44
45 if _N_=1 then do;
46
47 do I=1 to (&nobs.);
48
49 R(I)=rand('gamma',1,1);
50
2 The SAS System 18:27 Sunday, May 1, 2022
51 end;
52
53
54 diff=&nobs. - sum(of R[*]);
55
56 do I=1 to diff;
57
58 R[ceil(rand('gamma', &nobs.,1))] + (diff>0);
59
60 end;
61
62 VET+sum(of R[*]);
63
64 end;
65
66 ran=r[_N_];
67 output;
68 end;
69
70 run;
ERROR: Array subscript out of range at line 58 column 1.
lastobs=0 i=1 n=2 diff=4.7355896866 VET=105.65851235 ran=0.3109976073 _ERROR_=1 _N_=1
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 2 observations read from the data set WORK.WEIGHT_1.
WARNING: The data set WORK.WEIGHT_2 may be incomplete. When this step was stopped there were 1 observations and 5 variables.
WARNING: Data set WORK.WEIGHT_2 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
71
72 %LET _CLIENTTASKLABEL=;
73 %LET _CLIENTPROCESSFLOWNAME=;
74 %LET _CLIENTPROJECTPATH=;
75 %LET _CLIENTPROJECTPATHHOST=;
76 %LET _CLIENTPROJECTNAME=;
77 %LET _SASPROGRAMFILE=;
78 %LET _SASPROGRAMFILEHOST=;
79
80 ;*';*";*/;quit;run;
81 ODS _ALL_ CLOSE;
82
83
84 QUIT; RUN;
85
If I remove line 41, 67, 68, the code will work. But I want to replicate the code &nboot. times. Should I delete "call streaminit(1293)" to have different seeds for each sample?
Sorry for my slow response because I want to check my code carefully.
... View more