This is a bit of a weird request....I have some data on aircraft flights that I need to break out depending on how many times they appear in a group. The group is identified as follows:
daily_grouping
104042452
104042452
104042452
104042452
104042452
104042452
104042453
104042454
104042455
104042455
104042456
104042456
104042456
There are other variables as well, but the daily_grouping is the one to key in on. Here is what I would like:
1. If a daily_grouping number appears only once, it should be removed.
2. If a daily_grouping number appears more than once, then the first instance should be removed and n-1 should remain.
This means that in the example above the result would be:
daily_grouping
104042452
104042452
104042452
104042452
104042452
104042455
104042456
104042456
Any help would be appreciated! Not sure if multiple steps are needed.
data have; input daily_grouping :$10.; datalines; 104042452 104042452 104042452 104042452 104042452 104042452 104042453 104042454 104042455 104042455 104042456 104042456 104042456 ; data want; set have; by daily_grouping; if not first.daily_grouping; run;
data have; input daily_grouping :$10.; datalines; 104042452 104042452 104042452 104042452 104042452 104042452 104042453 104042454 104042455 104042455 104042456 104042456 104042456 ; data want; set have; by daily_grouping; if not first.daily_grouping; run;
data have; input daily_grouping :$10.; datalines; 104042452 104042452 104042452 104042452 104042452 104042452 104042453 104042454 104042455 104042455 104042456 104042456 104042456 ; proc sort data=have dupout=want nodupkey; by daily_grouping ; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.