- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have 5 character variable, all start with prefix '_' (variable name).
I need to set missing values for all these variable and don't want to write array for this.
could someone please help?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This will set ALL variables whose names start with _ to missing:
data want; set have; call missing (of _:); run;
The : is a list creator for all the variable that start with a common string (could be more characters in common). The "of" tells the function that you want to use a list.
Call missing is one of the few functions that operates on mixed numeric or character variables so is good go to choice for setting things missing. Arrays would require two different arrays if you have mixed variable types.
@abhinayingole wrote:
I have 5 character variable, all start with prefix '_' (variable name).
I need to set missing values for all these variable and don't want to write array for this.
could someone please help?
If you have other variable that start with _ that you don't want to set to missing then just list them in the Call Missing function:
Call missing(_x, _y, _pdq); or what have you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This will set ALL variables whose names start with _ to missing:
data want; set have; call missing (of _:); run;
The : is a list creator for all the variable that start with a common string (could be more characters in common). The "of" tells the function that you want to use a list.
Call missing is one of the few functions that operates on mixed numeric or character variables so is good go to choice for setting things missing. Arrays would require two different arrays if you have mixed variable types.
@abhinayingole wrote:
I have 5 character variable, all start with prefix '_' (variable name).
I need to set missing values for all these variable and don't want to write array for this.
could someone please help?
If you have other variable that start with _ that you don't want to set to missing then just list them in the Call Missing function:
Call missing(_x, _y, _pdq); or what have you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content