I'm used the import wizard in SAS EG to import a sheet from an Access database. I have a query later on referencing this sheet that throws an error because one of my variables is text (ERROR: the AVG summary function requires a numeric argument), whereas it should really be a number.So, I closed out of SAS EG, went into the Access database and changed the type to number. Then, went back into SAS EG and tried running but got the same error. So then I proceeded to choose "Modify Import Data" off the import. First, a box pops up that says: The following field names are either missing from the source file or have a different base data type (string or numeric) than they originally did: My_variable (String). I clicked okay, albeit a little confused. I proceeded to modify the import, and in the define field attributes part, I changed the type of my variable to Number. The source Informat defaulted to BEST-1., which seems like an odd informat name (is it even valid?). So I clicked finish and ran it and now it is giving me the errors:
70 GPI : $CHAR14.
71 Drug_Name : $CHAR60.
72 MAC_Price : BEST-1.
__
22
ERROR 22-322: Expecting a name.
73 Eff_Date : BEST32.
ERROR: Missing numeric suffix on a numbered variable list (BEST-NAME).
When I attempt to change this source informat, by clicking the dropdown, I received an error saying that SAS has encountered a problem, which I have inserted a screenshot of below. Is this a bug? Any way around it? Thank you for the help.
That looks like a bug to me. So that answers your question, but doesn't solve the problem.
If possible, I'd try to start over again in a new project, just to see if a clean slate will help create a process that imports the way that you need it. I'm assuming that you're relying on the EG Import Data task and that you don't have a way to use PROC IMPORT or SAS/ACCESS to ODBC to read this data by using SAS code. If those are options, I'd recommend them since they are probably more robust.
By using the EG Import Data task, you're getting EG to read the table, convert it to an intermediate text format, and then read into a SAS data set.
That looks like a bug to me. So that answers your question, but doesn't solve the problem.
If possible, I'd try to start over again in a new project, just to see if a clean slate will help create a process that imports the way that you need it. I'm assuming that you're relying on the EG Import Data task and that you don't have a way to use PROC IMPORT or SAS/ACCESS to ODBC to read this data by using SAS code. If those are options, I'd recommend them since they are probably more robust.
By using the EG Import Data task, you're getting EG to read the table, convert it to an intermediate text format, and then read into a SAS data set.
If the file were not overly large, perhaps the Access data could be output as tab delimited text or csv. The text could then be uploaded to your primary server and loaded into SAS using INFILE and INPUT (or PROC IMPORT or imported via SAS EG). This is sort of a work around if what Chris suggested doesn't take care of the bug.
If you do use INFILE and INPUT, make sure to specifiy the DSD option (for delimited data) and then tell SAS exactly what delimiter you're using (tab, pipe, comma, etc.). Below I'll list a sample with a "pipe" (vertical bar) as the delimiter. Note the use of the colon in the INPUT statement.
FILENAME Raw_Data "&RawData./&RawFile";
DATA SAS_Data.&SAS_File;
INFILE Raw_Data
LRECL=32760
ENCODING="LATIN1"
DLM='|'
MISSOVER
DSD
OBS=&Obs
FIRSTOBS=1
END=_End_of_File
;
INPUT
TT_HSN : 8.
TT_PIN : $CHAR30.
TT_TIN : $CHAR12.
;
Hope that helps,
Jim
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.