Help using Base SAS procedures

proc tabulate

Reply
Contributor
Posts: 22

proc tabulate

so i had little proc tabulate exp & cant figure out how to make mine work.


data national;

array num [3] n_total n_reas n_noreas;
array pct [3] noreas_pct reas_pct in_pct;

retain n_total n_reas reas_pct n_noreas noreas_pct in_pct;
set national;
by offtype2;

if first.offtype2 then
do i = 1 to 3;
num = .; pct = .;
end;

if _type_ in ('00', '10') then n_total=n;
else if _type_ in ('01', '11') then
do;
num[hasreas]=n;

if _type_ = '01' then num[hasreas]=pctn_00; /* TOTAL ROW */
else pct[hasreas]=pctn_10; /* ANY OTHER ROW */
end;

if last.offtype2 then output;

run;


i keep getting the out of range array error message..
Super Contributor
Super Contributor
Posts: 3,174

Re: proc tabulate

You will want to add some PUTLOG _ALL_; SAS statements in your DATA step, to debug what's happening along the way - that should help reveal the problem situation and cause. Also, otherwise having posted the SAS log information which would provide SAS variable values at the time of the error would go along with helping others debug your program.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 127 views
  • 0 likes
  • 2 in conversation