Thanks for taking a stab at this. I modified your code for my purposes but I get an error: Syntax error, expected something like a name or a Unicode delimited identifier between the word 'num' and '='. Here is my code:
num = ROW_NUMBER() OVER (PARTITION BY DXCD1 ORDER BY DXCD1())
In addition to what's already been pointed out, you need to remove the brackets "()" after DXCD1.
It appears that you are trying to order by the same value that you are partitioning by. The reason for the NEWID(), was simply to take a *random* sampling of the records for the given partition.