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 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 25. 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
  • 1 reply
  • 1547 views
  • 1 like
  • 2 in conversation