From: Dimitri Shvorob on 15 Oct 2009 07:25 (Sorry if this is a double-post: SAS-L/PC issues). I am PROC IMPORT'in a large number of common-format Excel spreadsheets and concatenating resulting datasets. Occasionally, a numeric column in a spreadsheet has no values (empty cells), and is interpreted by SAS as having char type, tripping up subsequent data-step concatenation with 'Variable x has been defined as both character and numeric' error. PROC APPEND with FORCE option ploughs through, to encounter a different, familiar problem: if char column s has shorter values in the 'base' dataset than in the 'data' one, column length of s is determined by 'base', and strings in 'data' truncated. (The same would happen with 'data ab; set a b; run;', of course). I am guessing that 1. I cannot make PROC IMPORT see that a variable is numeric, not char, so PROC APPEND it is. 2. LENGTH issue can be resolved by 'seeding' the concatenation with an empty dataset, created by a data step with a custom (alas) series of 'length' statements. Can anyone suggest a better way? Thank you.
|
Pages: 1 Prev: Excel Read-In Oddity Next: Robustifying batch Excel import |