G'day!
For the file below, for the variable GSS, if we're looking to find a facility that has the number 6 between the ranges for
i.e, for GSS=-8 and GSS=1-9, etc, we want to keep the field 'code' and 'GSS' where the span includes a 6,
how would you do that.
For example, where
facilitycode=01100170112607 and GSS = 0-12
since GSS has a range between 0,1,2,3,4,5,6,7,8,9,10,11 and 12, there is a 6, how do we identify this facility as one we want to keep because it has a 6 in the range into a separate dataset?
We need to do this for all the observations in the dataset.
Would you separate out GSS in the example above 2 variables: GSLow=0 GSHigh=12 and then ask SAS to determine if there is a 6 in that span?
Any help you can give will be much appreciated!
Thank you!
/* --------------------------------------------------------------------
-------------------------------------------------------------------- */
DATA WORK.'Sch gss'n;
LENGTH
F1 $ 14
F2 $ 5 ;
FORMAT
F1 $CHAR14.
F2 $CHAR5. ;
INFORMAT
F1 $CHAR14.
F2 $CHAR5. ;
INFILE DATALINES4
DLM='7F'x
MISSOVER
DSD ;
INPUT
F1 : $CHAR14.
F2 : $CHAR5. ;
DATALINES4;
FaclityCodeGSS
011001701126070-12
011001701239680-8
011001701241720-8
011001701255670-8
011001701294036-8
016115060904350-5
016115060904680-5
;;;;
Want:
The first 5 lines of the dataset above that have 6 in the span of GSS
... View more