BookmarkSubscribeRSS Feed
Lopa2016
Fluorite | Level 6
Hi,

In my dataset the variables which are indicated by diffrent range say Female_Age_Band are given as 15-20,20-25,25-30,...& so on.But the problem is wherever the data is unavailable that particular observation is labelled as "Unavailable" which is making sas to read this field as a character. So I believe this will make it difficult to invoke this variable in logistic regression.Further , there are also certain categorical fields which has say 3 distinct indicators 0 1 & 2 .But even these fields have the "Unavailable" label.Cannot technically replace with zeroes because zero might be a valid value.

Can someone help with a solution ?
3 REPLIES 3
Shmuel
Garnet | Level 18

"Unavailable" is a chrachter type field.

You need to create a new numeric variable using

  data temp;

    set have;

      new_variable = input(old_variable, ?? best.);

  run;

in this case the non numeric value will be assigned as missing value

and that is what you need for statistics and analyze.

Lopa2016
Fluorite | Level 6

Using this also converts the ranges to missing values so the values for eg say 10-20 ,20-30,... are even replaced with missings

ballardw
Super User

Setting them to missing > removed from analysis. SAS will discard any record from analysis where any of the model variables are missing. If you don't assign them a "valid" category then you may as well use where clause to subset the data as they would be excluded anyway.

 

Or take a pass at imputing but I wouldn't go that route unless the number of "missing" or "unavailable" is large relative to the sample size. How large? depends on the actual data.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 806 views
  • 0 likes
  • 3 in conversation