I would like to delete all variables of a dataset, in which all observations have the same value (-94).
My approach was the following:
Code:
local abc *all variables of the dataset*
tostring `abc', replace force
foreach var of local abc {
replace `abc' = "" if `abc' == "-94"
}
Otherwise I would have continued with the dropmiss command.
Some information to the Dataset. Is has 1900 variables but only 106 Observations. The variables are both, string and numerical, hence I had to do the tostring command in the beginning.
My Question:
What caused the Type missmatch and how can I prevent it from happening?
And do you maybe know another way to delete a great amount of variables which do not have missing values (but as I mentioned, always the same value)?
Thank you for your time!
0 Response to deleting variables with the same values
Post a Comment