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

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 4153 views
  • 4 likes
  • 3 in conversation