Very simple SAS question. Any help?

Posts: 1

Very simple SAS question. Any help?

Hi all,

I have just started working with SAS and I have a relatively basic question. I have imported data into SAS and there are variables Q1, Q2, ..., Q21. Now for example, in Q1, the possible values are "Yes", "YES", "NA", "No", and "NO." I want YES and NA to change to Yes. And I want NO to change to No. So the end result would be only "Yes" and "No" values.

How am I able to do this? I have to leave work right now so I am unable to type out what I have tried, but I would appreciate any answers! My data is in "work.auditdata".

Super Contributor
Posts: 1,636

Re: Very simple SAS question. Any help?

data new;

  set work.auditata;

array _q(*) q1-q21;

do _n_=1 to dim(_q);




Valued Guide
Posts: 765

Re: Very simple SAS question. Any help?

hi ... another idea ...

data want;

set have;

array q(21);

do _n_=1 to 21;

  q(_n_) = ifc(q(_n_) eq 'NA' , 'Yes', propcase(q(_n_)));



Super User
Posts: 10,538

Re: Very simple SAS question. Any help?

Was this data generated by someone entering values or some selection method that allowed (@#$#$) redundant choices?

If some one is manually entering the data it may be time, if you haven't already, to run proc freq on this data.

I have had data entry people come up with 13 spellings for IBM when given a list of companies to expect and what to enter for that company. The most creative was I>B>M> as an example.

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation