f



Number" fields to "Text"

Hi All

I have a question and I hope this is the place where I will get the
answer. I need to read an excel file, that I can do by using the PROC
IMPORT, later I need to convert all the 'Number" fields to "Text" in
the data sets. Excel file may have one or more than one column. Excel
file may have all the variable of numeric type or the text type or
both. How to do that.

Please help me.

Thank You in advance
Ricky

0
sas_help (10)
4/7/2006 8:38:39 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

1 Replies
559 Views

Similar Articles

[PageSpeed] 41

Ricky:
Let's first switch to SAS terms and concepts. Columns in a SAS dataset
either have numeric typed data or character typed data. SAS does not
support mixed data types in one column (fortunately). So if you import
numbers and text in one MS Excel column, that column will almost always
be character typed. Check the properties of the column variable in PROC
CONTENTS, SQL DICTIONARY.columns, or interactively in Display Manager
Explorer.

SAS uses the PUT() function and an informat to convert numbers to
character variables. For numeric typed variable x, a Data step statement
along the lines of
   Y=PUT(X,8.);
 usually works OK for integer values.

I must warn you that MS Excel encourages people to make garbage out of
good data. Many SAS programmers spend many long hours trying to
reconstruct data from heaps of loosely related cells.
Sig

-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Ricky
Sent: Friday, April 07, 2006 4:39 PM
To: sas-l@uga.edu
Subject: Number" fields to "Text"


Hi All

I have a question and I hope this is the place where I will get the
answer. I need to read an excel file, that I can do by using the PROC
IMPORT, later I need to convert all the 'Number" fields to "Text" in the
data sets. Excel file may have one or more than one column. Excel file
may have all the variable of numeric type or the text type or both. How
to do that.

Please help me.

Thank You in advance
Ricky
0
HERMANS1 (2683)
4/7/2006 9:02:28 PM
Reply: