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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.