BookmarkSubscribeRSS Feed
Malene_KH
Calcite | Level 5

I'm working with biochemistry data, and in my data set the concentrations of different hormones are registrered as character variables with a comma as decimal separator instead of (the more international) period.

 

I want to change these character variables to numeric variables, and I have tried to use the INPUT function. This doesn't work - maybe because of the comma as decimal separator? Therefore, my questian is: how do I change the decimal separator from "," to ".", when the data is not even registrered as numeric? Maybe it is the format, that should be changed?

 

My variable is called T3_konc and have mostly data with 1 decimal (e.g. 1,3 and 5,8), but a few is "fail" or "hemolysis".

 

I have tried:

   Data Thyroid_hormones_new;

   Set Thyroid_hormones;

   If T3_konc = ',' then T3_konc='.';

   run;

                                  This didn't work, maybe because the results are not just a comma - the comma is only the separator.

 

 

To change from character to numeric variable I have tried:

     Data Thyroid_hormones;

     T3_konc_n = input(T3_konc, best9.);

     run;

 

 

Thank you!

 

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

> a comma as decimal separator instead of (the more international) period.

 

One might disagree; it's basically the English colonies plus Japan, Korea and and China using the decimal point.

Not unlike the side of the road used for driving (north America and China switched side).

 

ChrisNZ_0-1607291797980.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3922 views
  • 4 likes
  • 3 in conversation