Dear,
I need help in my pgm to filter records based on non-missing values. In my output I need records with non missing values in at least in one variable(CQ11NAM -CQ14NAM) (SMQ01nam-SMQ04NAM). I tried CMISS function and list all variables here. But in my actual data I have more than 60 variables. Please suggest. Thank you
data one;
input CQ11NAM $1 CQ12NAM $3 CQ13NAM $5 CQ14NAM $7 SMQ01NAM $9 SMQ02NAM $11 SMQ03NAM $13 SMQ04NAM $15 id 17;
DATALINES;
a 3
a 2
1
d 5
f 4
;
data two;
set one;
if cmiss(of CQ11NAM-CQ14NAM,of SMQ01NAM-SMQ04NAM) lt 8 then flag='Y';
if flag='Y';
run;
Use the double dash like this
data two;
set one;
if cmiss(of CQ11NAM -- SMQ04NAM) < 8;
run;
A nice article on creating variable lists is 6 easy ways to specify a list of variables in SAS.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.