Help using Base SAS procedures

flag variables

Reply
Contributor
Posts: 65

flag variables

Hi i am trying to estimate a logic model. However my explanotary flag variables both include 0, "." (missing values) and  i need to code missing values as "0"

Because i have about 40 variables do you know an esay way yo solve this problem

Frequent Contributor
Posts: 140

Re: flag variables

Posted in reply to omerzeybek

I am not sure what you mean by a "logic model" (perhaps logistic?) nor am I sure what you mean by "flag variables".

Furthermore, coding missing as 0 is often a mistake.

Nevertheless, if you want to do so you can do it in an array (the following code is not tested):

data new;

set old;

array misszero (*)  YOUR LIST OF VARIABLES HERE;

  do i = 1 to dim(misszero);

    if misszero(i) = . then misszero(i) = 0;

  end;

run;

Contributor
Posts: 65

Re: flag variables

yes i was trying to build a logistic regression

i am  trying to implement your code to my project but unfortunately still i couldnt make it

however thank you very much for your interest

Frequent Contributor
Posts: 140

Re: flag variables

Posted in reply to omerzeybek

What do you mean 'couldn't make it'? What was the error message?

Ask a Question
Discussion stats
  • 3 replies
  • 224 views
  • 0 likes
  • 2 in conversation