Is there a simple way in SAS to convert a string to a SAS-safe name that would be used as a column name?
ie.
Rob Penridge ----> Rob_Penridge
$*@'Blah@* ----> ____Blah__
I’m using a proc transpose and then want to work with the renamed columns after the transpose.
EDIT:
8 year follow-up… is there now a better way to do this? I feel like I saw a better method sometime back but I’m struggling to find any documentation/examples now that I need to do it.
proc transposewill take those names without any modification, as long as you setoptions validvarname=any;If you want to work with the columns afterwards, you can use the NLITERAL function to construct named literals that can be used to refer to them: