BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hashman
Ammonite | Level 13

Another way of achieving the goal in a single step is using CALL VNEXT instead of the dual arrays (as suggested by @mkeintz on SAS-L) coupled with CALL EXECUTE:

data have ;                                     
  input ID :$3. X_1 X_2 X_3 Y_1 Y_2 W_3  :$1. ; 
  cards ;                                       
ID1 1 2 3 4 5 6 C                               
ID2 2 3 4 5 6 7 D                               
run ;                                           
                                                
data _null_ ;                                   
  set have (obs = 1) ;                          
  length _vn $ 32 ;                              
  call execute ("data want; set have(keep=") ;  
  do until (cmiss (_vn)) ;                      
    call vnext (_vn) ;                          
    if find (_vn, "3") then call execute (_vn) ;
  end ;                                         
  call execute ("); run;") ;                    
run ;                                           

Kind regards

Paul D.

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 16. 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
  • 15 replies
  • 2160 views
  • 9 likes
  • 6 in conversation