This is probably easy, but maybe not. I have data as:
origin destination distance_km
CYYC CYUL 100
EGGL EDDF 200
They airport combinations (origin and destination). Many occur and can repeat.
How could I get output of unique airport combinations with the average km?
For example, the output would show for every unique origin/destination pair
origin destination avg_distance_km
CYYC CYUL 101.554
EGGL EDDF 202.678
thanks
How is the value 101.554 calculated?
Use PROC MEANS (or SUMMARY they are the same proc). You can either sort the data and use BY statement. Or use a CLASS statement. If you use a class statement you might want to add NWAYS and MISSING option.
thanks! I am using
PROC MEANS data=EGTASK.CCDA_BILLABLE NOPRINT NWAY MISSING;
CLASS depart dest;
VAR GOA_FLOWN_GC_DISTANCE;
OUTPUT OUT=EGTASK.CCDA_PAIRS_AVG_KM_TMP MEAN=;
RUN;
and it seems good!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.