BookmarkSubscribeRSS Feed
BroniusBaniulis
Calcite | Level 5

Hi, I'm looking to replicate the behaviour of python sklearn.preprocessing StandardScaler library.

I use the 'proc standard' to achieve the result of 'transform' as is the method called in the StandardScaler. However the StandardScaler has the functionality to later inverse_transform data based on the same values that were used to transform the data. The reason this is useful is because it can do this to datasets that are not the original, but have been derived form the original (Think the genetic algorithm implementation on the standardised data). I need to 'unstandardise' the mutated standardised data...

Is there something in SAS that can do this or the implementation would have do be done manually by preserving the values used to standardise the dataset and then apply them to reverse it?

 

Thanks!

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Is there something in SAS that can do this or the implementation would have do be done manually by preserving the values used to standardise the dataset and then apply them to reverse it?

 

It's not really clear what your question is. If you have the original data set, which you should, then yes of course you can unstandardize the data, it's in the original data set. Why wouldn't you have access to the original data?

 

Otherwise, you would need to have stored somewhere the mean and standard deviation used to do the standardization. If you have that, then you don't have to "manually" undo the standardization, you can write simple SAS code to do this.

 

And if you don't have either of the above, then its no longer a SAS question at all. There is no mathematical way to unstandardize data if you don't know the mean and standard deviation.

--
Paige Miller
BroniusBaniulis
Calcite | Level 5
I guess in that case my question becomes - How can i get the MEAN and
Standard Deviation values that the 'proc standard' used for standardisation?
PaigeMiller
Diamond | Level 26

Do you have the original data set, with the unstandardized data?

--
Paige Miller
Reeza
Super User

You can capture the output from PROC STANDARD or PROC MEANS to keep the mean/standard deviation. 

 

FYI - If you have Enterprise Miner, it does the scoring from start to finish, you don't have track your steps, the scoring code generated there will replicate the process from your input data to model. 

 


@BroniusBaniulis wrote:
I guess in that case my question becomes - How can i get the MEAN and
Standard Deviation values that the 'proc standard' used for standardisation?

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1134 views
  • 0 likes
  • 3 in conversation