SAS--exclude the first few rows -
i have set of data below. need exclude first few rows 'counts <100' based on model. once counts >100, following rows kept no matter counts > 100 or <100.
|make |model |soldmonth|counts| |ford |class_c |jan_2015 |80 | |ford |class_c |feb_2015 |90 | |ford |class_c |mar_2015 |70 | |ford |class_c |apr_2015 |120 | |ford |class_c |may_2015 |130 | |ford |class_c |jun_2015 |50 | |ford |class_c |jul_2015 |70 | |ford |class_c |aug_2015 |140 | |ford |class_c |sep_2015 |110 | |ford |maxi |jan_2015 |20 | |ford |maxi |feb_2015 |50 | |ford |maxi |mar_2015 |80 | |ford |maxi |apr_2015 |120 | |ford |maxi |may_2015 |130 | |ford |maxi |jun_2015 |110 | |ford |maxi |jul_2015 |180 | |ford |maxi |aug_2015 |90 | |ford |maxi |sep_2015 |110 |
here want get:
|make |model |soldmonth |counts| |ford |class_c |apr_2015 |120 | |ford |class_c |may_2015 |130 | |ford |class_c |jun_2015 |50 | |ford |class_c |jul_2015 |70 | |ford |class_c |aug_2015 |140 | |ford |class_c |sep_2015 |110 | |ford |maxi |apr_2015 |120 | |ford |maxi |may_2015 |130 | |ford |maxi |jun_2015 |110 | |ford |maxi |jul_2015 |180 | |ford |maxi |aug_2015 |90 | |ford |maxi |sep_2015 |110 |
any assistance appreciated!
you can create flag set when first value ge 100 found , use determine observations output.
data ford; input (a b c)($) y; cards; ford class_c jan_2015 80 ford class_c feb_2015 90 ford class_c mar_2015 70 ford class_c apr_2015 120 ford class_c may_2015 130 ford class_c jun_2015 50 ford class_c jul_2015 70 ford class_c aug_2015 140 ford class_c sep_2015 110 ford maxi jan_2015 20 ford maxi feb_2015 50 ford maxi mar_2015 80 ford maxi apr_2015 120 ford maxi may_2015 130 ford maxi jun_2015 110 ford maxi jul_2015 180 ford maxi aug_2015 90 ford maxi sep_2015 110 ;;;; run; proc print; run; data ford2; set ford; b notsorted; if first.b f=0; if not f , y lt 100 f+0; else f=1; if f; run; proc print; run;
Comments
Post a Comment