1

I am reading this post about setting all missing values of a dataset to 0.

However, it seems that it only apply to datasets with numeric data types only. What if I have data with character and numeric data types at the same time? I cannot declare an array like array a(*) _numeric_; or array a(*) _character_;, and it seems that using ALL is not acceptable in arrays. What is the appropriate ways to get around it then?

Jinhua Wang
  • 1,679
  • 1
  • 17
  • 44
  • You state you cannot use the _numeric_ or _character_ lists but then marked that response as correct? – Reeza Jun 28 '17 at 15:08

1 Answers1

2

If you want BOTH numeric and character variables to be set to 0 / "0" you have to run two arrays - eg as follows:

array __missnums _numeric_;
do over __missnums;
  if __missnums=. then __missnums=0;
end;
array __misschars _character_;
do over __misschars;
  if __misschars="" then __misschars="0";
end;

It makes no difference if your dataset contains variables of both types, the _numeric_ and _character_ keywords only apply to the numeric / character vars accordingly.

Allan Bowe
  • 12,306
  • 19
  • 75
  • 124