How do I rename the rows in the observation

267 views Asked by At

here I am using proc freq

Proc freq data=external_raw;
    table Marital_status;
run;

this the table the shows up:

Marital_status Frequency Percent Cumulative Frequency Cumulative Percent
1 15851 8.38 15851 8.38
2 122370 64.68 138221 73.06
3 2645 1.40 140866 74.45
4 10216 5.40 151082 79.85
5 32141 16.99 183223 96.84
9 5975 3.16 189198 100.00

I want to change 1="Single", 2= "Married", 3= "Separated", 4= "Divorced", 5= "Widowed" and 9= "Unknown".

Screenshot of above table
screenshot of above table

1

There are 1 answers

0
Stu Sztukowski On

Format it with proc format.

proc format;
    value status
        1 = 'Single'
        2 = 'Married'
        3 = 'Separated'
        4 = 'Divored'
        5 = 'Widowed'
        9 = 'Unknown'
    ;
run;

Then apply the format:

proc freq data=have;
    format marital_status status.;

    table marital_status;
run;