- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-13-2009 05:33 PM
(2179 views)
Hello,
I am reading a field AMT2 ($char10) in a flat file from mainframe. Although it's defined as $char10 in the input statement it contains numeric data only. It also contains a decimal point. (i.e. 10.50 )
INPUT @01 AMT2 $CHAR10
I use 'dollar' in the put statement
PUT @01 AMT2 DOLLAR
and this is what the output looks like: 10.50 .
Notice there is no '$' and there is a '.' at the end
Again, here is the input and the output
input: 10.50
output: 10.50 .
Does anyone know how I can put a '$' at the beginning?
Thank you!
I am reading a field AMT2 ($char10) in a flat file from mainframe. Although it's defined as $char10 in the input statement it contains numeric data only. It also contains a decimal point. (i.e. 10.50 )
INPUT @01 AMT2 $CHAR10
I use 'dollar' in the put statement
PUT @01 AMT2 DOLLAR
and this is what the output looks like: 10.50 .
Notice there is no '$' and there is a '.' at the end
Again, here is the input and the output
input: 10.50
output: 10.50 .
Does anyone know how I can put a '$' at the beginning?
Thank you!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You have a SAS character variable (text string) which contains a numeric value, so you must assign a SAS numeric variable (using a FORMAT for your DOLLAR. formatted output objective), and convert the character string to numeric, using the SAS INPUT function.
The SAS support website hosts SAS documentation and supplemental technical reference documents from SAS user conferences - here is a link example on this topic:
http://support.sas.com/kb/24/590.html
Related SAS DOC reference:
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000780416.htm
Scott Barry
SBBWorks, Inc.
The SAS support website hosts SAS documentation and supplemental technical reference documents from SAS user conferences - here is a link example on this topic:
http://support.sas.com/kb/24/590.html
Related SAS DOC reference:
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000780416.htm
Scott Barry
SBBWorks, Inc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Also when you 'put' the variable you need to add a dot to the end of DOLLAR so that SAS knows it is a format. Without the dot SAS assumes it is a variable name, it creates the variable and outputs it's value (which is obviously missing as you have not assigned anything to it). So SAS puts a dot in the output, i.e. it is tearting it as a missing numeric value.