From: Ruby on 11 Mar 2010 10:47 Hi SAS experts, I need to find out the qualified enrollees from enrollment dataset based on the following specification - Enrollees have been enrolled in the program for at least 6 months and with no more than one month gap in enrollment. I also have a character variable called "flag" to indicate monthly enrollment status.For example, "010000000001" stands for the member enrolled in February and December. Here is my code. if index(flag,'111111')^=0 or index(flag,'1011111')^=0 or index(flag,'1101111')^=0 or index(flag,'1110111')^=0 or index(flag,'1111011')^=0 or index(flag,'1111101')^=0 then output; Do you have a better way to code my question? Thanks very much!
From: Lou on 11 Mar 2010 12:59 "Ruby" <windofoct(a)gmail.com> wrote in message news:3e9a7ff1-b5c3-466d-8f96-0e090c4c94de(a)r1g2000yqj.googlegroups.com... > Hi SAS experts, > > I need to find out the qualified enrollees from enrollment dataset > based on the following specification - Enrollees have been enrolled in > the program for at least 6 months and with no more than one month gap > in enrollment. There seems to be a missmatch between the above description and the below example. For example, if FLAG = '101010101010', is that enrollee qualified? S/he's been enrolled for at least six months with no more than a one month gap in enrollment, but such a pattern isn't included in your example. > I also have a character variable called "flag" to indicate monthly > enrollment status.For example, "010000000001" stands for the member > enrolled in February and December. > Here is my code. > if index(flag,'111111')^=0 or > index(flag,'1011111')^=0 or > index(flag,'1101111')^=0 or > index(flag,'1110111')^=0 or > index(flag,'1111011')^=0 or > index(flag,'1111101')^=0 then output; > Do you have a better way to code my question? > > Thanks very much!
From: Patrick on 13 Mar 2010 08:20 Ruby If you're just looking at the last 7 months then whoever has more than one '0' is not qualified. The code below is based on this assumption. HTH Patrick data have; input flag $7.; qualified= length(compress(flag,'1'))<=1; put qualified=; datalines; 1011111 1101111 1110111 1111011 1111101 1101101 ; run;
|
Pages: 1 Prev: Maximum window size in SAS in linux Next: what is the main purpose of informat? |