Below is the final code that accomplishes what I needed. I have a few comments interspersed throughout here, but please let me know if you have any further questions or concerns. And thank you to everyone who chimed in here: proc import out = TextFromExcel datafile = "\\SAS01\sasusers\Shared\PredictiveModeling\PredictiveModelingCPM\TextToSAS.xlsx" dbms=xlsx replace; sheet="Sheet1"; getnames=yes; run; data TextFromExcel; set TextFromExcel; Text = lowcase(Text); rename Text = Text4Matching; run; * Duplicates were removed in Excel; libname Comments "\\SAS01\sasusers\Shared\PredictiveModeling\PredictiveModelingCPM\CommentsAnalysis"; * Long version, instead of wide; proc sql; create table scoresL as select CLAIMNO, COMMENTTEXT, Text4Matching, NumberForLabels from SRS_Comments500 inner join TextFromExcel on indexw(COMMENTTEXT, Text4Matching)>0 order by CLAIMNO, COMMENTTEXT, Text4Matching; quit; proc print data=scoresL noobs; run; * Removing situations where a particular code duplicates across comments - Be sure to also remove the comment so it is not an issue now either; proc sort data = scoresL (drop = COMMENTTEXT Text4Matching) nodupkey; by CLAIMNO NumberForLabels; run; * Getting a column of 1s in here so that when the data is transposed it has the pattern of 1s for each CLAIMNO; data scoresL; set scoresL; Dichotomous_Counter = 1; run; * But I need to reorganize this to be able to spread it out to be wide now; proc transpose data=scoresL out=FlaggedCommentsT prefix=flag_ name=Transposed_Column; by CLAIMNO; id NumberForLabels; run; proc print data=FlaggedCommentsT noobs; run;
... View more