PROC IMPORT in SAS: format issue

Salah -  
 Véronique -
Hello,
How can I force SAS to keep the same variable format from Excel when using a PROC IMPORT?
In my Excel file, the ID variable is alphanumeric, but SAS considers it a numeric variable and then puts a dot for values containing a letter.??

PS. I am using version 8 of SAS (so I can't use the mixed=yes option).

Thank you for your help.

3 answers

  1. Véronique
     
    There is the option mixed=yes which allows for the complete conversion to character.

    There is also the option guessingrows = 50 to specify the number of rows to scan to identify the type of the variable.
    3
  2. Stéphane
     
    I think we first need to create an empty dataset with the variables and their defined format (data x; length var1 $10....). Then, we import the data using the proc import in this dataset.
    I hope it will work.
    1
  3. ogo
     
    The PROC IMPORT assigns a format based on the first 8 rows. If these rows are predominantly numeric (or empty), then it will be numeric; if they are predominantly text, then it will be text.
    -1