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
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.
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
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!
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.