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.
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;
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;
Sure thing 🙂 Anytime.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.