BookmarkSubscribeRSS Feed
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. 

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;

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.



Diamond | Level 26

Or this:


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


and then the rest of your PROC MEANS statements.

Paige Miller



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3 in conversation