LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 26 Jan 2010 21:05:16 -0400
Reply-To:     Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject:      Re: problems selecting subst
In-Reply-To:  <201001270017.o0QM6pC4005228@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

Trish,

Could this be due to the wrong data type used? SUBSTR() works with a string and you are checking for the equality of '171 OR '172'. Your array PRX[ ] is numeric as well as variables DIAG1 - DIAG3. Be consistent in the use of data type and that would fix your issue.

On Tue, Jan 26, 2010 at 8:17 PM, Trish Bous <tboussard@gmail.com> wrote:

> The data are numeric: > Hi All, > > I am having some problems selecting a substring of data, and I was hoping > someone might have some insight on the problem. > > I am trying to select ICD-9 codes. My code works successfully in other > datasets, but I am not able to select my observations in the below dataset > and I am not sure why. > > My code that works on other datasets is as follows: > > > data z.NMSC; > set z.namc94; > tag = 0; > array prx (3) diag1-diag3; > do i = 1 to 3; > if substr (prx {i}, 1, 3) in ('171', '172') then tag = 1; > end; > run; > > In the dataset described below, the code does not select any observations. > However, if I change the code to the below, I select a few observations, > but > not the entire set I want: > > > data z.NMSC; > set z.namc94; > tag = 0; > array prx (3) diag1-diag3; > do i = 1 to 3; > if prx{i} in ('172100', '172110') then tag = 1; > end; > run; > > Any help on the problem? As a work around, I could list all possible codes > in the (), but there has to be a better way. > > > Dataset: > > 26 DIAG1 Num 8 > 27 DIAG2 Num 8 > > Example of data: > > Obs DIAG1 DIAG2 DIAG3 > > 1 172100 147790 900000 > 2 202509 900000 900000 > 3 184490 140190 144390 > 4 159900 207000 900000 > 5 172110 900000 900000 > 6 143590 900000 900000 > 7 141490 141390 900000 > 8 156400 145580 140190 > 9 147390 137230 149390 > 10 173530 147790 900000 > 11 149600 116200 900000 > 12 171900 100880 118500 > > > Thank you! >


Back to: Top of message | Previous page | Main SAS-L page