BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

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;
1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

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.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1976 views
  • 1 like
  • 2 in conversation