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

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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