That seems the way to go for a user written macro. For a SAS written procedure, the right way would…