BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
A_Halps
Obsidian | Level 7

I want to delete the rows that have empty columns for a certain range of columns (q7_16 - q7_505). The columns are not in numeric order. I don't want to write out each column because I have to do this with a much larger dataset next.

So, if columns q7_16, q7_17, q7_18, q7_19, q7_2, q7_2094, q7_504, and q7_505 are blank, then delete those rows.

 

Picture is attached to show the dataset.

 

I tried:

data severity_lrd_7_v3b;
	set severity_lrd_7;
		where survey_desc = "V3B";
		if n(of q7_16-q7_505);
run;

but then it adds every number from 16-505 which I do not want.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Provided that your variables of interest are side by side, you can do this

 

data severity_lrd_7_v3b;
	set severity_lrd_7;
		where survey_desc = "V3B";
		if n(of q7_16--q7_505);
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Provided that your variables of interest are side by side, you can do this

 

data severity_lrd_7_v3b;
	set severity_lrd_7;
		where survey_desc = "V3B";
		if n(of q7_16--q7_505);
run;
A_Halps
Obsidian | Level 7
What an easy fix, thank you!!!
PeterClemmensen
Tourmaline | Level 20

Sure thing 🙂 Anytime.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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