Hello
I am using SAS 9.1.
I have a health data database which has 20 procedures. I want to loop through them all and if it meets a certain criteria then indicate "Y" in the "surg" field.
The code I'm using is:
array proccde[20] $ proc1-proc20;
length surg $1.;
do i = 1 to 20;
if (substr(proccde,1,1)="1" and substr(proccde,4,2) in ('50','51','52','53','54','55','56'
'57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74'
'75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92',
'93','94','95','96','97','98','99') or
(substr(proccde,1,1)="5" and substr(proccde,4,2) in ('45','46','47','48','49','50','51','52','53','54','55','56'
'57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74'
'75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92',
'93','94','95','96','97','98','99'))) then surg="Y"; else surg="N";
The above works if only selecting on Proc1 but not with using the array. Please help - thanks.
I am using SAS 9.1.
I have a health data database which has 20 procedures. I want to loop through them all and if it meets a certain criteria then indicate "Y" in the "surg" field.
The code I'm using is:
array proccde[20] $ proc1-proc20;
length surg $1.;
do i = 1 to 20;
if (substr(proccde,1,1)="1" and substr(proccde,4,2) in ('50','51','52','53','54','55','56'
'57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74'
'75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92',
'93','94','95','96','97','98','99') or
(substr(proccde,1,1)="5" and substr(proccde,4,2) in ('45','46','47','48','49','50','51','52','53','54','55','56'
'57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74'
'75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92',
'93','94','95','96','97','98','99'))) then surg="Y"; else surg="N";
The above works if only selecting on Proc1 but not with using the array. Please help - thanks.