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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 595 views
  • 0 likes
  • 3 in conversation