BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

 

ImportError.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
jimbarbour
Meteorite | Level 14

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2121 views
  • 1 like
  • 3 in conversation