|
Dave,
I would force SAS to read in the variables from the Excel file the way you
want it to, i.e. as character. Save the Excel file as comma delimited and
read into SAS via a data step using infile and informat statements for each
variable.
A trick would be to use PROC IMPORT in the cvs file, check the log (which
should show the actual data step SAS used for the import), and then copy and
paste, re-run the data step version with the changes you need to add (such
as var1 is character). For some datasets that PROC IMPORT will work with,
SAS will show the data step in the log. If there is an engine for a
database, such as Access or Excel, it will not show this in the log.
John Gerstle
CDC Information Technological Support Contract (CITS)
Biostatistician
Phone: 404-639-3980 Fax: 404-639-2980
Cell: 770-639-5060 Email: jgerstle@cdc.gov
> -----Original Message-----
> From: David Stone [mailto:david_p_stone@HOTMAIL.COM]
> Sent: Tuesday, January 28, 2003 1:09 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Help on Proc Import for an Excel 2000 file
>
> I have an excel file that has a column with text and numbers and I would
> like it to be imported as text.
> If the first row is a number, it appears that a numeric format is assumed,
> if it's text, then text is assumed.
> The problem is that in each case, the opposite format is not loaded intp
> the
> sas dataset.
>
> eg.
> VALUE DATASET VALUE
> ==========================
> march 2003 march 2003
> 200303
> Q3 Q3
>
> VALUE DATASET VALUE
> ==========================
> 200303 200303
> march 2003
> Q3
> ==========================
>
> I have tried everything with the excel file by selecting the column and
> making the format text, but that doesn't work. The only thing that does
> work
> is making 200303 => '200303. However, whenever this file is edited, I can
> see the user replacing '200303 with 200304 and forgetting the quote.
>
> Any suggestions ?
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
|