Help using Base SAS procedures

how to recode variables

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 75
Accepted Solution

how to recode variables

hello all-

suppose i have a dataset A with one variable x:

data A (keep=x);

do i=1 to 3 by 1;

     do x=1 to 2 by 1; output;

     end;

end; run;

1

2

1

2

1

2

now i want to recode this data set where if x=1 then x='no'; else x='yes'. thus now A will look like

no

yes

no

yes

no

yes

any way to do this?

thanks


Accepted Solutions
Solution
‎08-02-2011 12:31 PM
Super User
Posts: 17,784

how to recode variables

You have your proc format, use it with a put statement.

x1_temp=put(x1, xone.);

View solution in original post


All Replies
Solution
‎08-02-2011 12:31 PM
Super User
Posts: 17,784

how to recode variables

You have your proc format, use it with a put statement.

x1_temp=put(x1, xone.);

Frequent Contributor
Posts: 75

how to recode variables

thanks again reeza :-)

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 247 views
  • 0 likes
  • 2 in conversation