0

I'm trying to pull data stored as $24. I want to convert it from character to numeric. The input(variable-name,comma24.) function is not working for me. A sample of the data is given below.

5.35 5.78 413,000 3,280,000 5.97 6.72 5 6.53 6 4.59 4.25 5 6.38 6.41 4.1 6.56 5.45 6.07 4.28 5.54 5.87 3.88 5.53 5.65 6.47 207,000 4,935,000 4,400,000 6,765,000 2,856,000 53,690,000

1
  • Have you tried comma24.2? Commented May 13, 2014 at 19:05

1 Answer 1

1

You don't show your code, but for some reason I could get it work when the reading and conversion were in different data steps, but not when it was the same data step.

The following works just fine:

DATA one;
  INPUT y: $24. @@;
DATALINES;
5.35 5.78 413,000 3,280,000 5.97
RUN;

DATA one;
  SET one;
  z = INPUT(y, comma24.);
RUN;

However if I put the calculation of z in the first data step, I was getting missing values without any error message. I have no explanation for this behavior, but hopefully the workaround will work for you as well.

Sign up to request clarification or add additional context in comments.

1 Comment

FWIW, putting conversion in the first data step (after the first input statement) works fine for me; SAS 9.2M3 / Windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.