Hi Experts ,
I havea a data set that the values are showed like different raws and I want to make that raws in a single column .No problem if the claim and suffixs shows multiple times
the data Have
Claim Suffix ICD10A ICD10B ICD10C ICD10D ICD10E
12589 1 vvg ijk ghy ilk opl
12589 2 rty ilk rtr erd owe
data want
Claim Suffix ICD10
12589 1 vvg
12589 1 ijk
12589 1 ghy
12589 1 ilk
12589 1 opl
12589 2 rty
12589 2 ilk
12589 2 rtr
12589 2 erd
12589 2 owe
How to proceed with this scenario Please advice
@jdwaterman91 minor suggestion:
Data Some2; Set Some; Array New A--E; Do _N_ = 1 to 5; ICD10 = New(_N_); if not missing(ICD10) then Output; End; Keep Claim Suffix ICD10; Run;
@ambadi007 did not indicate whether or not the data may sometimes only have fewer than 5 codes, or possibly no codes at all, and what the output for those cases might be. I am assuming that a row with a missing ICD10 is pretty useless and excluding them.
PROC TRANSPOSE - wide to long.
https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/
Transpose via a DATA step
https://stats.idre.ucla.edu/sas/modules/reshaping-data-wide-to-long-using-a-data-step/
Would something like this work for your situation?
data Some;
input Claim Suffix A $ B $ C $ D $ E $;
datalines;
12589 1 vvg ijk ghy ilk opl
12589 2 rty ilk rtr erd owe
;
run;
Data Some2;
Set Some;
Array New A--E;
Do _N_ = 1 to dim(New);
ICD10 = New(_N_);
Output;
End;
Keep Claim Suffix ICD10;
Run;
@jdwaterman91 minor suggestion:
Data Some2; Set Some; Array New A--E; Do _N_ = 1 to 5; ICD10 = New(_N_); if not missing(ICD10) then Output; End; Keep Claim Suffix ICD10; Run;
@ambadi007 did not indicate whether or not the data may sometimes only have fewer than 5 codes, or possibly no codes at all, and what the output for those cases might be. I am assuming that a row with a missing ICD10 is pretty useless and excluding them.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: