Shuail_CR007
Shuail_CR007

Reputation: 312

Changing the value in data set using PROC SCORE using SAS

I'm New to SAS Please can one help me how to change the value of data set using PROC SCORE. I have two data set as shown below image how to append the label value from data set 2 to set 1.

If gender is 1 We should append the value as M from the set 2

data set image

Upvotes: 0

Views: 103

Answers (1)

Tom
Tom

Reputation: 51566

SAS uses formats as the way to display values in human friendly ways. Looks like you want to convert your second table into a format definition so that you can attach that format to the GENDER variable in your first dataset.

From the description it sounds like you want to generate a custom format like this:

 proc format ;
   value gender 1='M' 0='F' other='O' ;
 run;

You could then use a FORMAT statement, inside your Proc SCORE step, to associate the custom format to your GENDER variable.

 format gender gender. ;

It is possible to build a format from a dataset, but you have not described any way to match the values of 0 and 1 in the first dataset to the values M or F in the second dataset. What was the logic for deciding that 1 should be mapped to M? Is it because M is first in the table? Is it because F comes before M in the alphabet and 0 comes before 1 in numeric ordering?

Upvotes: 1

Related Questions