Problem statement: I have a data set flying which consist of variables:
[1]origin [2]destination [3]carrier [4]delay
Now I want to replace the missing value in variable delay with average delay on the specific route(source-destination) and carrier.
If i use proc stdize for imputation it replace the missing value with the average of variable delay which I dont want to do.
Any suggestion/help will appreciate.
My code :
proc stdize data=flight missing=mean reponly out=missing_flight;
var air_time;/* delay*/
by origin dest carrier notsorted ;
run;
It shows some warning :
After that I check my missing values in the output dataset missing_flight . It is still missing and imputation is not done.
what am I doing wrong here?
Add a BY statement to PROC STDIZE to group by source/destination.
@deltaskipper wrote:
Problem statement: I have a data set flying which consist of variables:
[1]origin [2]destination [3]carrier [4]delay
Now I want to replace the missing value in variable delay with average delay on the specific route(source-destination) and carrier.
If i use proc stdize for imputation it replace the missing value with the average of variable delay which I dont want to do.
Any suggestion/help will appreciate.
Add a BY statement to PROC STDIZE to group by source/destination.
@deltaskipper wrote:
Problem statement: I have a data set flying which consist of variables:
[1]origin [2]destination [3]carrier [4]delay
Now I want to replace the missing value in variable delay with average delay on the specific route(source-destination) and carrier.
If i use proc stdize for imputation it replace the missing value with the average of variable delay which I dont want to do.
Any suggestion/help will appreciate.
Maybe you misinterpreted what NOTSORTED means in the BY statement. NOTSORTED means that the data is grouped by the origin, dest, and carrier variables, but that they are not in ascending or descending order. Try sorting your data prior to calling STDIZE without the NOTSORTED keyword.
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.