BookmarkSubscribeRSS Feed
icedcoffee3011
Calcite | Level 5

Hi all, 

 

My dataset has assigned values 1-6 to a variable. I would like to recode the "6" to a "." because this value is throwing off my Proc Means statement for a scale that should be 1-5. Is there syntax to be able to do this? Is there a way to delete all of the "6" in the dataset?

 

Thank you. 

2 REPLIES 2
ballardw
Super User

Data step would be the basic tool.

Style choice involved whether to create a new variable or change actual value.

 

data new;
   set have;
   if variable=6 then variable= .R;
run;

The .R is a "special missing". It will not be used in any calculation but you can check the value to tell that it is one that was Recoded (the special missing could be any .letter from .A to .Z or ._ ) to differentiate from any others that might be missing for a different reason.

 

 

PaigeMiller
Diamond | Level 26

Or this:

 

proc means data=yourdatasetname(where=(yourvariablename^=6));

 

and then the rest of your PROC MEANS statements.

--
Paige Miller

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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