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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: