As this query is still marked 'Not answered' I thought you might be looking for code.  Here is my suggestion.  I've assumed the word NULL in your table is a token for a null value, not the literal value; however if that is not the case you can substitute  <>  'NULL'  for  IS  NOT NULL.  This code is not tested.  The results may not be in the same ID order as the input data.    *   Assuming ID is unique ;    Proc Transpose          Data    =   Communications          Prefix  =   TVG_Values_          Name    =   Original_TVG_Column          Out     =   TVG_Data          ;      By  ID  Notsorted ;      Var TVG_MSO: ;      *   Selects all columns beginning with TVG_MSO ;  Run ;    Proc Transpose          Data    =   Communications          Prefix  =   NTIA_Values_          Name    =   Original_NTIA_Column          Out     =   NTIA_Data          ;      By  ID  Notsorted ;      Var NTIA_MSO: ;      *   Selects all columns beginning with NTIA_MSO ;  Run ;    Proc SQL ;      Create Table   Comm_Matches    As          Select                Distinct                  TVG.ID              ,   TVG.TVG_Values_1    As  Matching              ,   TVG.Original_TVG_Column              ,   NTI.Original_NTIA_Column          From    TVG_Data    TVG              ,   NTIA_Data   NTI          Where   NTI.ID              =   TVG.ID              And NTI.NTIA_Values_1   =   TVG.TVG_Values_1              And NTI.NTIA_Values_1   IS  NOT NULL              And TVG.TVG_Values_1    IS  NOT NULL              ;  Quit ;   
						
					
					... View more