Help using Base SAS procedures

excel engine dbSAStype not importing variable correctly

Reply
Contributor
Posts: 23

excel engine dbSAStype not importing variable correctly

Hi, I am trying to import a file that has a variable, var1, where the first 600 values are 1 and the next 200 values are character strings. (I know, it's annoying and weird, but the data come as they come). I set the excel workbook as a library with:


libname lib excel "<file-name>.xlsx";


data dat;

set lib."data$"n (dbSAStype = (var1 = "CHAR(200)") );

run;


What I am getting is that var1 is a character variable with 600 "1"s but the 200 character strings are empty, as if it were numeric and dumped the characters. Am I doing something wrong? Please help!


(p.s., I know I can resort the data, delete the 1s, etc. etc. I'm really trying to minimize the amount I manipulate the data in Excel, and the fact that this didn't work makes me realize that I don't understand, so I'm trying to.)


Regular Contributor
Posts: 221

Re: excel engine dbSAStype not importing variable correctly

MS Excel is not in the list of supported data sources, see SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Sixth Edition for more details.

Ask a Question
Discussion stats
  • 1 reply
  • 144 views
  • 0 likes
  • 2 in conversation