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-white.png

Special offer for SAS Communities members

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.

 

View the full agenda.

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
  • 1786 views
  • 1 like
  • 2 in conversation