BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bal23
Lapis Lazuli | Level 10

where it contains lots of missing values, say 98% of obs have missing values.

 

whether i use

if var1 NE . then var2 ="M";

or if var1 ne "." then var2 ="M"

it does not work, i do see lots of missing values, but just cannot create var2

any advice?

thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Missing for character values is not "."

It would be easier to use

 

if not missing(var1) then var2='M';

 

as the Missing function will use the correct comparison for numeric or character as needed.

View solution in original post

4 REPLIES 4
ballardw
Super User

Missing for character values is not "."

It would be easier to use

 

if not missing(var1) then var2='M';

 

as the Missing function will use the correct comparison for numeric or character as needed.

Bal23
Lapis Lazuli | Level 10

thank you, but how to identify those missing values, I need to identy those as well, how to create a variable and give a vlue for those with missing values

ballardw
Super User

If missing(var1) then var2='whateveryouwantto assign';

Reeza
Super User

Are your variables character or numeric? Are they all the same type?

 

Post an example of what your data looks like and what you want as an output.

I think you want an array, assign the variables to the array and then loop through and create variables that flag if they're missing.

 

Also, what isyour end goal with flagging these as missing? There may be another way to get it. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 876 views
  • 2 likes
  • 3 in conversation