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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.