Hello, I am trying to pick up the specified data from the HAVE dataset. By using the HAVE table as an example, Obs HRM_L2 PERSON_CTRY_CODE Type GEOGRAPHIC_DESCR_ degree 1 A 0 2 A CN 0 3 A TW 31192X TW 9 4 B 3 5 B FR 0 6 B IT 0 7 B KR 745666 KR 8 8 B US 745666 US 9 9 C 745666 TH 3 10 C GB 0 11 C US 0 1.For each 'HRM_L2' group, if one of the degrees is larger or equal than 6 (i.e.,6,7,8,9) then I would like to have that observation. and has a note as 1 for example, for 'A' group, I expect to only keep the 'Obs' 3 as the degree is 9. 2.in the 'B' group, both 'Obs' 7 and 'Obs' 8 are larger than 6 then I expect to keep both of them, and have a note as 2. 3. if all of degree is less than 6 in the 'HRM_L2' group, then I expect to keep all of them and with a note 3. the result is expected to look like below. Obs HRM_L2 PERSON_CTRY_CODE Type GEOGRAPHIC_DESCR_ degree Note 3 A TW 31192X TW 9 1 7 B KR 745666 KR 8 2 8 B US 745666 US 9 2 9 C 745666 TH 3 3 10 C GB 0 3 11 C US 0 3 Could you please give me some suggestion about this? thanks in advance data have ;
infile cards dsd dlm=",";
input HRM_L2 $ PERSON_CTRY_CODE $ Type $ GEOGRAPHIC_DESCR_ $ degree ;
cards ;
A,,,,0
A,CN,,,0
A,TW,31192X,TW,9
B,,,,3
B,FR,,,0
B,IT,,,0
B,KR,745666,KR,8
B,US,745666,US,9
C,,745666,TH,3
C,GB,,,0
C,US,,,0
;
run; .
... View more