BookmarkSubscribeRSS Feed
Amy0223
Quartz | Level 8

Hi everyone!

I have a SAS question about how to remove some values in a row and only keep the first column and the last column which is the total.  Thanks so much!

 

Amy0223_0-1600974921164.png

 

6 REPLIES 6
PaigeMiller
Diamond | Level 26

The easiest thing to do is simply delete variables c0 through c4.

--
Paige Miller
Amy0223
Quartz | Level 8
Thanks! How to program it to delete those values?
PaigeMiller
Diamond | Level 26

Clarification: I said delete the variables, not delete the values.

 

data want;
    set have;
    drop c0-c4;
run;
--
Paige Miller
Amy0223
Quartz | Level 8
Is there a way to keep the variables but only delete c0-c4 values?
PaigeMiller
Diamond | Level 26

You would have to have a missing value which is a dot, as these variables are numeric.

 

In a SAS data step, use

 

call missing(c0,c1,c2,c3,c4);
--
Paige Miller
CurtisMackWSIPP
Lapis Lazuli | Level 10

@PaigeMiller wrote:

You would have to have a missing value which is a dot, as these variables are numeric.

 

In a SAS data step, use

 

call missing(c0,c1,c2,c3,c4);

Or for a little added flair

call missing(of c0-c4);

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 1196 views
  • 1 like
  • 3 in conversation