Page 1 of 1

Converting a Number into String

Posted: Tue Sep 16, 2014 7:20 am
by franciscoA
This should be fairly simple. I'm trying to convert a numeric field into a string.

series FieldName = @str(CustomerNumber)
I get an error message: Can not assign string expression to numeric variable in...

The CustomerNumber is a number between 10 and 15 digits. It is also used to give structure to the series in panel data.

What could be the problem?

Re: Converting a Number into String

Posted: Tue Sep 16, 2014 7:28 am
by startz
alpha FieldName rather than series FieldName

Re: Converting a Number into String

Posted: Tue Sep 16, 2014 7:37 am
by franciscoA
Thank you. That worked. But I can still solve my problem. The string is being written as scientific notation. What I'm actually trying to do is to get the last four digits:
alpha FieldName = @str(CustomerNumber)

series NewCustomer = @right(FieldName, 4)

returns = e+13

Re: Converting a Number into String

Posted: Tue Sep 16, 2014 7:40 am
by startz
Take a look at the Help system documentation for @str. You can supply a format specification that might give you what you want.