BookmarkSubscribeRSS Feed
sandhya88
Calcite | Level 5

DATA HAVEDATA HAVEDATA WANTDATA WANT

 

In the above images the data that i have is on the left side in a table where only few records are having CRITFl populated for the ID.

The image on the right is what i want to achieve populating the value of critfl across all the records of the ID.

 

Any Suggestions are grateful.

 

TIA

2 REPLIES 2
PaigeMiller
Diamond | Level 26

What happens if the ID has both Y and N? What happens if the ID has neither Y nor N?

 

Please do not type in ALL CAPITALS.

 

Please provide example data as SAS data step code, which you can type in yourself or you can get by following these instructions (and not via screen captures or via file attachments). We cannot write code to read screen captures.

--
Paige Miller
sandhya88
Calcite | Level 5
 
Data have;
input ID$ PARAMCD$ RESULT BASERSLT CRITFL$;
datelines;
004	ALT	       0.03	 0.03	
004	ALT	       0.06	 0.03	
004	AST	       0.03	 0.03	
004	CHOL      0.03	 0.03	
004	4HCHOL	  0.03	 0.03	
004	ALT	      0.12	 0.03        Y
004	LIPA	  0.09	 0.09	
005	ALT   	  0.03	 0.03	
005	AST	      0.06	 0.04	
005	CHOL	  0.03	 0.03	
005	4HCHOL	  0.03	 0.03	
005	ALT	      0.06   0.03	     N
005	LIPA	  0.12	 0.12	
;
Data want;
input ID$ PARAMCD$ RESULT BASERSLT CRITFL$;
datelines;
004	ALT	      0.03	 0.03	Y
004	ALT	      0.06	 0.03	Y
004	AST	      0.03	 0.03	Y
004	CHOL      0.03	 0.03	Y
004	4HCHOL	  0.03 0.03	Y
004	ALT	        0.12	  0.03   Y
004	LIPA	  0.09	 0.09	Y
005	ALT   	  0.03	 0.03	N
005	AST	      0.06	 0.04	N
005	CHOL	  0.03	 0.03   N	
005	4HCHOL	  0.03	 0.03   N	
005	ALT	      0.06   0.03	N
005	LIPA	  0.12	 0.12	N;


1.CRITFL for the ID will have either "Y" or "N" and not a combination and hence if at least one record of ID has a "Y" or "N" or even "" i want to see that being retained to all the other records of the ID.


Hope this is a bit helpful and apologies for the attachments.

Thanks

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 2 replies
  • 490 views
  • 1 like
  • 2 in conversation