I have patient encounter file with more than 13000 records. File structure is like this.
No Problemtype1 problemtype1b problemtype1c ... problemtype49 prblemtype49c outcome1 outcome1b ... outcome49c
--------------------------------------------------------------------------------------------------------------------------------------------------------------
1 aa bb cc aa bb solved rejected denied
2
...
13000
I need to count respective outcomes if problemtype is 'aa'. I tried using 2 dimentional array but its not working.
How to solve this problem ? Please help me. I am new to SAS.
No. I am getting error.
ERROR: Array subscript out of range at problemType = pt{i};
@BKPatel wrote:
No. I am getting error.
ERROR: Array subscript out of range at problemType = pt{i};
Means that you assigned a value to i that doesn't match the size of the array PT when created. Usually by incrementing to large but if your base index is something other than 1 then othe possibilities abound.
Here is some sample code. change the var and arrays from 5 to 49.
data have; *infile yourfile end=eof;
input n:5. (prob1 prob2 prob3 prob4 prob5) (:$8.)
(outcom1 outcom2 outcom3 outcom4 outcom5) (:$20.);
array prob {5} $8 prob1-prob5;
array outcom {5} $20 outcom1-outcom5;
do x=1 to 5 ;
if prob{x}='aa' then do;
if outcom{x}='solved' then solved+1;
if outcom{x}='rejected' then rejected+1;
if outcom{x}='denied' then denied+1;
end; end;
*if eof then output;
cards;
1 aa bb cc aa bb solved rejected denied solved denied
2 aa bb cc aa bb solved rejected denied solved denied
3 aa bb cc aa bb solved rejected denied solved denied
;
proc print; run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.